Answers for "php sort array by highest value"

PHP
0

php sort array by value length

function sortByLength($a,$b){
    return strlen($b)-strlen($a);
}
usort($array,'sortByLength');
Posted by: Guest on September-23-2020
1

php sort array by value

$price = array();
foreach ($inventory as $key => $row)
{
    $price[$key] = $row['price'];
}
array_multisort($price, SORT_DESC, $inventory);
Posted by: Guest on June-19-2021

Code answers related to "php sort array by highest value"

Browse Popular Code Answers by Language