当前位置:网站首页>PHP krsort() function
PHP krsort() function
2022-06-24 05:11:00 【User 1448800】
example
Sort the associative array in descending order by key name :
<?php
$age=array("Bill"=>"60","Steve"=>"56","mark"=>"31");
krsort($age);
?>Definition and Usage
krsort() Function to sort an associative array in descending order by key name .
grammar
krsort(array,sortingtype);
Parameters | describe |
|---|---|
array | It's necessary . Specify the array to sort . |
sortingtype | Optional . Specifies how to arrange the elements of an array / project . Possible value :0 = SORT_REGULAR - Default . Put each item in the regular order (Standard ASCII, Don't change the type )1 = SORT_NUMERIC - Treat each item as a number .2 = SORT_STRING - Treat each item as a string .3 = SORT_LOCALE_STRING - Treat each item as a string , Based on the current locale ( It can be done by setlocale() Make changes ).4 = SORT_NATURAL - Treat each item as a string , Use similar natsort() Natural ordering .5 = SORT_FLAG_CASE - Can combine ( Press bit or )SORT_STRING or SORT_NATURAL Sort strings , Case insensitive . |
- 0 = SORT_REGULAR - Default . Put each item in the regular order (Standard ASCII, Don't change the type )
- 1 = SORT_NUMERIC - Treat each item as a number .
- 2 = SORT_STRING - Treat each item as a string .
- 3 = SORT_LOCALE_STRING - Treat each item as a string , Based on the current locale ( It can be done by setlocale() Make changes ).
- 4 = SORT_NATURAL - Treat each item as a string , Use similar natsort() Natural ordering .
- 5 = SORT_FLAG_CASE - Can combine ( Press bit or )SORT_STRING or SORT_NATURAL Sort strings , Case insensitive .
explain
krsort() The function sorts the array in reverse order by key , Keep the original key for the array value .
The optional second parameter contains additional sort flags .
If successful , Then return to TRUE, Otherwise return to FALSE.
Technical details
Return value : | Return if successful TRUE, Return if failed FALSE. |
|---|---|
PHP edition : | 4+ |
边栏推荐
- How to select a suitable optical fiber tester
- Cos+cdn realizes the distribution of game client version files in a faster, better and cheaper manner
- Training methods after the reform of children's programming course
- What is required for domain name filing and how to select an enterprise domain name
- NAT
- Introduction to the "penetration foundation" cobalt strike Foundation_ Cobalt strike linkage msfconsole
- The personal information protection law was formally reviewed and passed. What issues should enterprises pay attention to?
- PHP sizeof() function
- How to create a virtual machine on vSphere client -- a reliable virtual machine creation tutorial
- The trunk warehouse can also be tob, and Tencent cloud microenterprises do not leave quality behind
猜你喜欢

011_ Cascader cascade selector

Analyzing the superiority of humanoid robot in the post human era
![[leetcode daily question] push domino](/img/81/1c31e97d9a245816514bcf47c92107.jpg)
[leetcode daily question] push domino

少儿编程教育在特定场景中的普及作用

少儿编程课程改革后的培养方式

Hard core observation 553 AI needs to identify almost everyone in the world with hundreds of billions of photos

Popularization of children's programming education in specific scenarios

Intensive learning and application of "glory of the king" to complete the application of 7 real worlds other than human players

让孩子们学习Steam 教育的应用精髓

Leetcode question brushing (question 3) - the longest substring without repeated characters
随机推荐
Ext4 file system jam caused by MEM CGroup OOM
Problem: SQL create stored procedure
Cos+cdn realizes the distribution of game client version files in a faster, better and cheaper manner
What are the functions and advantages of the Internet of things cloud platform?
CMU cs15-445 lecture01 relationship model course notes
Panoramic recording, WYSIWYG new recording scheme, and exclusive preferential resource package as low as 1 yuan!
[jest] summary of the use of automated test jest
Svg quick start small white article
How novices choose ECs and how to judge the quality of ECS
Pgbouncer lightweight PG connection pool management tool
What is the domain name of the website? How much is a domain name
Bi-sql where
PTA 1046 stroke (15 points)
Have you got the programmer's drawing tools and skills?
IP and traffic reconciliation tool networktrafficview
The principle of defer keyword in go
How to expand virtual machine capacity on vSphere client
What is the new generation cloud computing architecture cipu of Alibaba cloud?
Intensive learning and application of "glory of the king" to complete the application of 7 real worlds other than human players
System design: index