How can I sort an array keeping the correlation between the index and value?
Otherwise it functions the same: asort($array);
<?php
$myworld = array("a"=>"php","b"=>"learning","c"=>"i'm");
asort($myworld);
print_r($myworld);
?>
Which prints:
Array
(
[c] => i'm
[b] => learning
[a] => php
)
Comment on this Question and Answer >>>
ASK A QUESTION
More arrays PHP Questions
How do I count the number of times a value appears in an array?How do I remove an element from an array without changing the index values for the rest of the array?
How do I reverse the order of the elements in an array?
How can I display values in a two dimensional array?
How do we sort an array of names taken from a text file, displaying only unique names?
