In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Today, the editor will take you to understand what rsort is in php. The knowledge points in the article are introduced in great detail. Friends who feel helpful can browse the content of the article with the editor, hoping to help more friends who want to solve this problem to find the answer to the problem. Let's follow the editor to learn more about "what is rsort in php".
Rsort in php is a function that sorts array cells from highest to lowest, using syntax such as "rsort (array,sortingtype);" and returns TRUE if successful or FALSE if failed.
This article operating environment: Windows7 system, PHP7.1 version, DELL G3 computer
What do you mean by "rsort" in php?
Example usage of rsort function in php
After talking about the array method of ascending order, then the corresponding method of descending order appears. Before we officially reveal the method, you have learned the use of the sort function, so the corresponding descending function name is rsort (). The two functions are very similar in structural syntax. Here we introduce the concept, syntax, return value and descending examples of the rsort () function. The specific usage is as follows.
1. Concept
The rsort () function behaves in contrast to sort (), sorting array units from highest to lowest.
Note:
Sort by number if the array elements are numeric, alphabetically if the array elements are strings, and alphabetically if the array contains numeric values and text / strings.
two。 Syntax rsort (array,sortingtype); 3. Return value
Returns TRUE on success and FALSE on failure.
4. Example
The above will output:
0 = orange
1 = lemon
2 = banana
3 = apple
Fruits is sorted in reverse alphabetical order.
Expansion of grammar knowledge points:
Parameter description array is required. Specifies the array to sort. Sortingtype is optional. Specifies how to arrange the elements / items of the array. Possible values:
0 = SORT_REGULAR-default. Arrange each item in regular order (Standard ASCII, do not change the type).
1 = SORT_NUMERIC-treat each item as a number.
2 = SORT_STRING-treats each item as a string.
3 = SORT_LOCALE_STRING-treats each item as a string based on the current locale (which can be changed through setlocale ()).
4 = SORT_NATURAL-treats each item as a string, using a natural sort similar to natsort ().
5 = SORT_FLAG_CASE-Strings can be sorted in combination with (bitwise or) SORT_STRING or SORT_NATURAL, case-insensitive.
What is the framework of php? php framework: 1. Laravel,Laravel is a free and open source PHP application framework. 2. Phalcon,Phalcon is the fastest PHP framework. 3. Symfony,Symfony is a PHP framework for Web projects. 4. Yii,Yii is a fast, secure and professional PHP framework. CodeIgniter,CodeIgniter is a very agile open source PHP framework. 6. CakePHP,CakePHP is an old PHP framework. 7. Kohana recorder Kohana is an agile but powerful PHP framework.
Thank you for your reading. The above is the whole content of "what is rsort in php". Friends who learn it, hurry up and do it. I believe that the editor will certainly bring you better quality articles. Thank you for your support to the website!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.