Skip to content

Instantly share code, notes, and snippets.

@zmf
Created March 22, 2017 22:16
Show Gist options
  • Save zmf/199ca892ff7a9523dfe7220c743d9e6e to your computer and use it in GitHub Desktop.
Save zmf/199ca892ff7a9523dfe7220c743d9e6e to your computer and use it in GitHub Desktop.
<?php
// sort 'inventory' array by 2nd level value 'price'
$price = array();
foreach ($inventory as $key => $row)
{
$price[$key] = $row['price'];
}
array_multisort($price, SORT_DESC, $inventory);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment