$a = array(0=>\'a\',1=>\'b\',2=>\'c\', 3=>\'d\');
I want to change the order to be 3,2,0,1
:
$a = array(3=>\
Since arrays in PHP are actually ordered maps, I am unsure if the order of the items is preserved when enumerating.
If you simply want to enumerate them in a specific order:
$a = array(0=>'a',1=>'b',2=>'c', 3=>'d');
$order = array(3, 2, 0, 1);
foreach ($order as $index)
{
echo "$index => " . $a[$index] . "\n";
}