asort() function works in the same way as sort() and preserves the array's original key/value associations.
<?php
$dogs = array('A' => 'C', 'B' => 'D','X' => 'Z', 'Q' => 'T');
asort($dogs);
printf("<pre>%s</pre>\n", var_export($dogs, TRUE));
?>
Related examples in the same category