// Use "uasort" instead of "usort" function order_asc($a, $b) { return $b["popularity"] - $a["popularity"]; } uasort(array, "order_asc");