Reversing an Array Using arsort() : arsort « Data Structure « PHP






Reversing an Array Using arsort()

 
<?php 
    $dogs = array('A' => 'C', 'B' => 'D', 'X' => 'Z', 'Q' => 'T'); 
    arsort($dogs); 
    printf("<pre>%s</pre>\n", var_export($dogs, TRUE)); 
?>
  
  








Related examples in the same category

1.arsort( ) function reverse sorts it by its values while preserving the keys
2.arsort() function maintains the original index association and sorts the elements in reverse order.
3.Sorting with arsort()