3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $people = array( array("name"=>"Bob","age"=>8,"colour"=>"red"), array("name"=>"Greg","age"=>12,"colour"=>"blue"), array("name"=>"Andy","age"=>5,"colour"=>"purple") ); $arrSortArray = array(); foreach($people as $person) { foreach($person as $key=>$value){ if(!isset($arrSortArray[$key])){ $arrSortArray[$key] = array(); } $arrSortArray[$key][] = $value; } } $orderby = "name"; //change this to whatever key you want from the array var_dump(array_multisort($arrSortArray[$orderby],SORT_DESC,$people));
Output for 4.3.0 - 7.1.0
bool(true)