Sorting Arrays In PHP !!
In this article we discuss about different methods of sorting arrays in brief.
PHP Sorting Functions
PHP array elements can be sorted alphabetical, numeric order, in descending or ascending order.
Functions
- sort()
- rsort()
- asort()
- ksort()
- arsort()
- krsort()
Sort()
Sort() function sort arrays in ascending order.
Program :
Output :
berry
grapes
mango
rsort()
rsort() function sort arrays in descending order.
Program :
Output :
15
11
10
9
7
4
3
asort()
asort() function sort associative arrays in ascending order according to the value.
Program :
Output :
Key=1, Value=350
Key=2, Value=370
Key=3, Value=430
Key=2, Value=370
Key=3, Value=430
arsort()
arsort() function sort associative arrays in descending order according to the value.
Program :
Output :
Key=3, Value=430
Key=2, Value=370
Key=1, Value=350
Key=2, Value=370
Key=1, Value=350
ksort()
ksort() function sort associative arrays in ascending order according to the key.
Program :
Output :
Key=3, Value=370
Key=4, Value=430
Key=5, Value=350
Key=4, Value=430
Key=5, Value=350
krsort()
krsort() function sort associative arrays in descending order according to the key.
Program :
Output :
Key=5, Value=350
Key=4, Value=430
Key=3, Value=370
Key=4, Value=430
Key=3, Value=370
In this article we discuss about different functions to sort arrays.we see values can sort by keys and values in ascending or descending order.
Mesothelioma Survival Rates , Mesothelioma Attorneys California , Seattle Mesothelioma Lawyer , Mesothelioma Suit , Mesothelioma Claim , Wisconsin Mesothelioma Attorney , Mesothelioma Attorney illinois , Mesothelioma Trial Attorney ,Houston Mesothelioma Attorney , Mesothelioma Lawyer Dallas , New York Mesothelioma Law Firm,Mesothelioma Lawyer Asbestos Cancer Lawsuit , Mesothelioma Lawyers San Diego,Mesothelioma Litigation , Mesothelioma Attorney Assistance , Mesothelioma Lawyer Asbestos Cancer Lawsuit , Mesothelioma Lawyer Chicago , New York Mesothelioma Law Firm ,
Houston Mesothelioma Attorney , Mesothelioma Lawyer Dallas , Mesothelioma Care , Mesothelioma Trial Attorney , Mesothelioma Lawyer Texas , Lawsuit Mesothelioma , Truck Accident Attorney Los Angeles ,Asbestos Exposure Lawyers , Mesothelioma Cases , Emergency Response Plan ppt , Mesothelioma Lawyers San Diego , Asbestos Mesothelioma Lawsuit , Tennessee Mesothelioma Lawyer , Meso Lawyer , Mesothelioma Settlements Amounts , Mesothelioma Law Firms , New Mexico Mesothelioma Lawyer , Accident Attorneys Orange County , Mesothelioma Lawsuit ,Personal Injury Accident Lawyer , Purchase Structured Settlements , Firm Law Mesothelioma , Car Accident Lawyers Los Angeles , Mesothelioma Attorneys , Structured Settlement Company , Auto Accident Lawyer San Francisco , Mesotheolima , Los Angeles Motorcycle Accident Lawyer
Mesothelioma , Mesothelioma Lawyer Virginia , Seattle Mesothelioma Lawyer , Mesothelioma Attorney illinois , Mesothelioma Drug , Mesothelioma Attorney DirectoryMesothelioma Settlements , Mesothelioma Help , Mesothelioma ct , Mesothelioma Attorney Florida , Washington Mesothelioma Attorney , Best Mesothelioma Lawyers , Diagnosed With Mesothelioma , Mesothelioma Settlement Amounts , Mesothelioma Personal Injury Lawyers , Mesothelioma Compensation , Attorney Lawyer Mesothelioma ,Colorado Mesothelioma Lawyers,Mesothelioma Lawsuits , Mesothelioma Claims , Average Mesothelioma Settlement , Average Mesothelioma Settlement , Mesothelioma Law Suit , Alabama Mesothelioma Lawyer , alabama Mesothelioma Lawyer , utah mesothelioma lawyer , Dallas Mesothelioma Lawyer , Mesothelioma Attorney California , Mesothelioma Lawyer California ,Mesothelioma Survival Rates ,
Mesothelioma Attorneys California, Wisconsin Mesothelioma Attorney Mesotheliama , Mesothelioma Lawyer Virginia , Seattle Mesothelioma Lawyer , Mesothelioma Attorney illinois, Mesothelioma Trial Attorney Injury Lawyer Houston tx , Baltimore Mesothelioma Attorneys , Mesothelioma Care ,Mesothelioma Trial Attorney ,Mesothelioma Lawyer Texas , Mesothelioma Lawyer Dallas , Mesothelioma Care , Mesothelioma Trial Attorney , Mesothelioma Lawyer Texas , California Mesothelioma Attorney Philadelphia Mesothelioma Lawyer , Illinois Mesothelioma Lawyer , Mesothelioma Attorney , Mesothelioma Claims , Average Mesothelioma Settlement
Integrated ehr , Mesothelioma Law Sui , Mesothelioma Lawyer California,Mesothelioma Attorney California ,Mesothelioma Law Suits ,Dallas Mesothelioma Attorneys ,Mesothelioma Drug ,Mesothelioma Attorney Directory