Answers for "usort for keys php"

PHP
1

php usort keep keys

// Use "uasort" instead of "usort"
function order_asc($a, $b) {
  return $b["popularity"] - $a["popularity"];
}
uasort(array, "order_asc");
Posted by: Guest on April-05-2020

Browse Popular Code Answers by Language