Share on Google+Share on Google+

php array sort

This section demonstrates the use of sort function in the php array.

  • PHP Array sort function is used to sort the given array in ascending order.

Example of PHP Array Sort




foreach ($ar1 as $a)

echo " ".$a;

echo "<br>";



foreach ($ar1 as $a=>$b)

echo " ".$a." ".$b;



barak jack mac rock
0 barak 1 jack 2 mac 3 rock 


Posted on: October 27, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.