$array_temp_id = array_column($companions, 'temp_id'); array_multisort($array_temp_id, SORT_DESC, $companions);