array sorting from multiple collection of array
<?php
$inventory = array(
   array(“type”=>”pork”, “price”=>5.43),
   array(“type”=>”fruit”, “price”=>2.90),
   array(“type”=>”milk”, “price”=>3.50),
);
print_R($inventory);
$price = array();
foreach ($inventory as $key => $row)
{
    $price[$key] = $row[‘type’];
}
print_R($price);
array_multisort($price, SORT_DESC, $inventory);
print_R($inventory);
?>
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...