Sunday, 9 June 2013

How to sort arrays in php?


Example -
We have in-built functions to sort arrays in php as shown below.
1.      sort() - sort indexed arrays in ascending order
2.      rsort() - sort indexed arrays in descending order
3.      asort() - sort associative arrays in ascending order, based upon the value
4.      ksort() - sort associative arrays in ascending order, based upon the key
5.      arsort() - sort associative arrays in descending order, based upon the value
6.      krsort() - sort associative arrays in descending order, based upon the key


Code and Syntax


Explanation

 For more php questions and answers, dumps,tutorials for beginners and experienced people visit http://www.top-php-interview-questions.blogspot.in  If you find any errors while executing this program, you can make your comments or mail me at reply2sagar@gmail.com






No comments:

Post a Comment