- usort: documentation ( source)
<?php
// Everything you enter here will be executed by our servers. Try it!
$array = array(
"id1" => array("unique" => 3),
"id2" => array("unique" => 5),
"id3" => array("unique" => 1),
);
usort($array, function ($a, $b){
if ($a['unique'] == $b) {
return 0;
}
return ($a['unique'] < $a['unique']) ? -1 : 1;
});