Answers for "php array sort by key and value"

PHP
1

sort array by key value in php

$inventory = array(

   array("type"=>"fruit", "price"=>3.50),
   array("type"=>"milk", "price"=>2.90),
   array("type"=>"pork", "price"=>5.43),

);
$price = array_column($inventory, 'price');
array_multisort($price, SORT_DESC, $inventory);
Posted by: Guest on June-03-2021
0

php array sort by key

ksort(array &$array, int $sort_flags = ?): int
Posted by: Guest on September-06-2021

Code answers related to "php array sort by key and value"

Browse Popular Code Answers by Language