How sort the array on base of array key:PHP

Hello friends! Hope you doing well :) If you want to sort the array on base of array key then just follow my code given below: <?php $myarray = array( array(“name”=>”Bob”,”price”=>8,”colour”=>”red”), array(“name”=>”Greg”,”price”=>12,”colour”=>”blue”), array(“name”=>”Andy”,”price”=>5,”colour”=>”purple”)); $sortArray = array(); foreach($myarray as $person){     foreach($person as $key=>$value){         if(!isset($sortArray[$key])){             $sortArray[$key] = array();         }         $sortArray[$key][] = $value; …