The method by which PHP sorts an array by using the sort () function, the sort array
This example describes how PHP sorts the array by using the sort () function. Share to everyone for your reference. The specific analysis is as follows:
The sort () function is used to sort the array, and this function assigns the new key name to the cells in the group. The original key name is deleted.
Returns TRUE if successful, otherwise FALSE.
$alpha = Array ("X", "a", "F", "C"); sort ($alpha); foreach ($alpha as $var) {print "$var
";}
Example 2
<?php$my_array = Array ("A" = "Dog", "b" = "Cat", "c" = "Horse"); sort ($my _array);p rint_r ($my _array);? >
return results
Array ([0] = cat[1] = dog[2] = Horse)
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/969489.html www.bkjia.com true http://www.bkjia.com/PHPjc/969489.html techarticle PHP uses the sort () function to order the array, and the sort array describes how PHP sorts the array by using the sort () function. Share to everyone for your reference. The specific analysis is as follows: ...