I have an array :
array(1) { ["myarr"]=> array(5) {
[0]=> array(2) { ["symbol"]=> string(6) "EUR" ["desc"]=> string(6) "da" }
[1]=> array(2) { ["symbol"]=> string(6) "USD" ["desc"]=> string(6) "adad" }
[2]=> array(2) { ["symbol"]=> string(6) "CHF" ["desc"]=> string(6) "das23" }
[3]=> array(2) { ["symbol"]=> string(6) "GBP" ["desc"]=> string(6) "dd12" }
[4]=> array(2) { ["symbol"]=> string(6) "NOR" ["desc"]=> string(6) "233" }
}
}
Now i need sort array by symbol in order: NOR, USD, EUR, CHF , GBP
So i wrote callback function
uasort($myarr , 'sort_myarr')
function sort_myarr($a, $b) {
static $sizes = array( 'NOR' => 0, 'USD' => 1, 'EUR' => 2, 'CHF' => 3, 'GBP' => 4);
return $sizes[$a] - $sizes[$b];
}
But doesn't sort :(