当前位置:网站首页>PHP uasort() function
PHP uasort() function
2022-06-24 05:10:00 【User 1448800】
example
Use the user-defined comparison function to compare the array $arr The key values of the elements in the :
<?php
function my_sort($a,$b)
{
if ($a==$b) return 0;
return ($a<$b)?-1:1;
}
$arr=array("a"=>4,"b"=>2,"c"=>8,d=>"6");
uasort($arr,"my_sort");
?>Definition and Usage
uasort() Function to sort an array using a user-defined comparison function , And keep index Association ( Don't assign new keys to elements ).
Return if successful TRUE, Otherwise return to FALSE.
This function is mainly used to sort the associative arrays whose cell order is very important .
grammar
uasort(array,myfunction);
Parameters | describe |
|---|---|
array | It's necessary . Specify the array to sort . |
myfunction | Optional . Define the string that can call the comparison function . If the first parameter is less than or equal to or greater than the second parameter , Then the comparison function must return a value less than or equal to or greater than 0 The integer of . |
Technical details
Return value : | Return if successful TRUE, If it fails, return to FALSE. |
|---|---|
PHP edition : | 4+ |
边栏推荐
- Where to buy domain name space? Can the domain name be repeated?
- How to expand virtual machine capacity on vSphere client
- What are the functions and advantages of the Internet of things cloud platform?
- Integration of Alibaba cloud SMS services and reasons for illegal message signing
- Introduction to the "penetration foundation" cobalt strike Foundation_ Cobalt strike linkage msfconsole
- Hard core observation 553 AI needs to identify almost everyone in the world with hundreds of billions of photos
- The function of nearby people in the applet is realized, and the cloud development database is used to realize nearby people and friends within a distance of the neighborhood
- Introduction to vulnerability priority technology (VPT)
- Ext4 file system jam caused by MEM CGroup OOM
- Where can I buy a domain name? Does the domain name have promotion space?
猜你喜欢

Let children learn the application essence of steam Education

"Emergency response practice" logparser log analysis practice

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

Zhang Xiaodan, chief architect of Alibaba cloud hybrid cloud: evolution and development of government enterprise hybrid cloud technology architecture

CTF learning notes 18:iwesec file upload vulnerability-03-content-type filtering bypass

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

Training methods after the reform of children's programming course

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

What is the new generation cloud computing architecture cipu of Alibaba cloud?

Leetcode (question 1) - sum of two numbers
随机推荐
Analysis of PHP environment configuration
SUSE system cannot install cosfs solution
How to clone virtual machines on vspere client
The conference assistant hidden in wechat is the best way to work efficiently!
Bi-sql and & or & in
The easyplayer player displays compileerror:webassembly Reason for instance() and its solution
Loss and optimization of linear regression, machine learning to predict house prices
The principle of defer keyword in go
Svg quick start small white article
Spirit breath development log (12)
Eigen eigenMatrix
Detailed explanation of tcpip protocol
Detailed explanation of the process after the browser enters the domain name and web address
Cos+cdn realizes the distribution of game client version files in a faster, better and cheaper manner
查找GBase 8c数据库当前索引?
The most complete regular expression summary in the whole network, so that you can get twice the result with half the effort. Collect it quickly
Shutter - how to copy certain elements from a map to a new map in dart/shutter?
NAT
What is an ECS? ECS、BCC、CVM...
Real time monitoring: system and application level real-time monitoring based on flow computing Oceanus (Flink)