I have this array:
$routes = array(
array(
\'code\' => \'PZSA\',
\'name\' => \'PLaza san antonio\',
),
array(
\'code\' => \'AVAD\
$target_flip = array_flip($target);
usort($routes, function($a, $b) use ($target_flip){
return ($target_flip[$a['code']] < $target_flip[$b['code']]) ? -1 : 1;
});
Demo:
Docs: