Sorting an Array by Its Values
<?php
$nums = array(15, 2.2, -4, 2.3, 0);
sort($nums);
printf("<pre>%s</pre>\n", var_export($nums, TRUE));
$words = array('bird', 'fish', 'George', 'Aden');
sort($words);
printf("<pre>%s</pre>\n", var_export($words, TRUE));
$chars = implode('', array_map('chr', range(32, 255)));
print $chars;
$dogs = array('A' => 'AA', 'Bud' => 'BB','C' => 'D');
sort($dogs);
printf("<pre>%s</pre>\n", var_export($dogs, TRUE));;
?>
Related examples in the same category