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
)
More arrays PHP Questions
How do I check if a variable is of array type?How do I reverse sort an array by key?
How do I turn an array into a string?
How do I add to the beginning of an array and find the number of elements in it?
How do I reverse sort the members of an array?