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 6327 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);

Leave a Comment


x

You might be Interested in these Posts

How to Create an Empty array without defining the size in C# ?

When we create an array in C# , we tend to define the size of the array as shown below. String[] st...

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...