Sort Associative array with asort method in PHP

Published on August 3, 2013 by abundantcode

Filed under PHP

Last modified August 3, 2013

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 0 (0 votes)

This article have been viewed 3130 times

You can use the function asort if you want to sort an associative array in PHP.

Sort Associative array with asort method in PHP

Below is a sample code snippet demonstrating the usage of asort method to sort Associative array in PHP.

$marks=array("a"=>"76","b"=>"100","c"=>"45");

asort ($marks);
0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a Comment


x

You might be Interested in these Posts

How to use array Rank in C# ?

In C# , the Rank property of the array is is used to get the rank of the array. In simple terms , ra...

How to get the Number of Elements in an MultiDimensional Array in C# ?

In one of the previous articles , we demonstrated the usage of the Length property of the array in C...

How to get the Number of Elements in an Array in C# ?

You can use the Length property of the array to return the number of elements in it. Note that once ...