I have this array:
$routes = array(
array(
\'code\' => \'PZSA\',
\'name\' => \'PLaza san antonio\',
),
array(
\'code\' => \'AVAD\
That's what array_multisort
if for:
foreach ($routes as $key => $row) {
$code[$key] = $row['code'];
$name[$key] = $row['name'];
}
array_multisort($code, SORT_ASC, $name, SORT_ASC, $routes);
print_r( $routes );
That way you don't even need a second array!
In fact in your case you need only to sort the codes so this will do the trick:
foreach ($routes as $key => $row) {
$code[$key] = $row['code'];
}
array_multisort($code, SORT_ASC, $routes);