How can I reverse sort an array keeping the correlation between the index and value?
By
Hi,
Can any one tell me how to to reverse sort an array keeping the correlation between the index and value?
Teacher SiliconIndia replied to Friday, November 27, 2009
Hi Naveen P,
This is done using the arsort function:
<?php
$myworld = array("a"=>"everything","b"=>"nothing","c"=>"is");
arsort($myworld);
print_r($myworld);
?>
Which prints this:
Array
(
[b] => nothing
[c] => is
[a] => everything
)