1function sortByAge($a, $b) {
2 return $a['age'] > $b['age'];
3}
4$people=[
5 ["age"=>54,"first_name"=>"Bob","last_name"=>"Dillion"],
6 ["age"=>22,"first_name"=>"Sarah","last_name"=>"Harvard"],
7 ["age"=>31,"first_name"=>"Chuck","last_name"=>"Bartowski"]
8];
9
10usort($people, 'sortByAge'); //$people is now sorted by age (ascending)
1array_multisort(array_map(function($element) {
2 return $element['order'];
3 }, $array), SORT_ASC, $array);
4
5print_r($array);
1 $keys = array_column($array, 'Price');
2
3 array_multisort($keys, SORT_ASC, $array);
4
5 print_r($array);
1function sortByOrder($a, $b) {
2 return $a['order'] - $b['order'];
3}
4
5usort($myArray, 'sortByOrder');