Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php usort keep keys

// Use "uasort" instead of "usort"
function order_asc($a, $b) {
  return $b["popularity"] - $a["popularity"];
}
uasort(array, "order_asc");
 
PREVIOUS NEXT
Tagged: #php #usort #keys
ADD COMMENT
Topic
Name
7+8 =