asort() function: array indexes maintain their original association with the elements. : asort « Data Structure « PHP






asort() function: array indexes maintain their original association with the elements.

 
The function's syntax is: void asort (array array)

<?
    $cities = array ("A", "N", "R", "V", "A");
    asort($cities);
//    for (reset ($cities); $key = key ($cities); next ($cities)) :
  //       print "cities[$key] = $cities[$key] <br>";
  //  endfor;
    print_r($cities);

?>
  
  








Related examples in the same category

1.After using asort()to return the array's elements to their original order
2.asort( ) function sorts array by its values while preserving the keys
3.asort() Constants
4.asort() function works in the same way as sort() and preserves the array's original key/value associations.
5.Sorting with asort()