Associative array sort by value
<?php usort($array, function($a, $b) { if($a['key']==$b['key']) return 0; return $a['key'] > $b['key']?1:-1; }); ?>