当前位置:网站首页>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+ |
边栏推荐
- Is it useful to build an industrial knowledge map platform?
- How does the mobile phone remotely connect to the ECS? What should be paid attention to during the operation
- Svg quick start small white article
- How Clickhouse queries imported data within a specified time period
- What is the use of domain name cloud resolution? What are the factors for domain name errors
- "Emergency response practice" logparser log analysis practice
- CLB health check principle and abnormal troubleshooting
- Why do hybrid clouds exist?
- SUSE system cannot install cosfs solution
- What is cloud server? How to access the ECS Homepage
猜你喜欢

Let children learn the application essence of steam Education
![[leetcode daily question] push domino](/img/81/1c31e97d9a245816514bcf47c92107.jpg)
[leetcode daily question] push domino

Loss and optimization of linear regression, machine learning to predict house prices

014_ TimePicker time selector

『渗透基础』Cobalt Strike基础使用入门_Cobalt Strike联动msfconsole

Leetcode (question 2) - adding two numbers

CTF learning notes 17:iwesec file upload vulnerability-02 file name filtering bypass

Introduction to the "penetration foundation" cobalt strike Foundation_ Cobalt strike linkage msfconsole

"Emergency response practice" logparser log analysis practice

Leetcode (question 1) - sum of two numbers
随机推荐
Leetcode (question 2) - adding two numbers
How to set easycvr recording plan batch and single channel settings?
Pgbouncer lightweight PG connection pool management tool
Why do hybrid clouds exist?
011_ Cascader cascade selector
Weak current engineer, 25g Ethernet and 40g Ethernet: which do you choose?
查找GBase 8c数据库当前索引?
2021-08-27: the normal odometer will display natural numbers in turn to indicate mileage, Kyrgyzstan
Verifying data models in golang
Use of golang testing framework test
How to select a suitable optical fiber tester
CLB health check principle and abnormal troubleshooting
GDB debugging container and command saving
Disaster recovery series (IV) - disaster recovery construction of business application layer
NLP baked gluten
Shutter - how to copy certain elements from a map to a new map in dart/shutter?
Analysis of PHP environment configuration
oracle数据库提示无操作权限的问题
Spirit breath development log (12)
"Emergency response practice" logparser log analysis practice