How do I sort this array by “departureIcao”?
I have tried many, many ways using array_multisort() & array_column(). Just not getting the idea here. Please, any help?
Array
(
[AAL1122] => Array
(
[callsign] => AAL1122
[departureIcao] => SKBO
[arrivalIcao] => KDFW
[wakeClass] => M
[onGround] =>
[state] => En Route
[flightRules] => I
)
[AAL190] => Array
(
[callsign] => AAL190
[departureIcao] => KORD
[arrivalIcao] => KJFK
[wakeClass] => H
[onGround] => 1
[state] => Boarding
[flightRules] => I
)
[AAL950] => Array
(
[callsign] => AAL950
[departureIcao] => SBGR
[arrivalIcao] => KJFK
[wakeClass] => H
[onGround] =>
[state] => En Route
[flightRules] => I
)
)
My last 2 tries were:
$a = array_multisort(array_column($flights, 'departure_icao'), SORT_ASC, $flights);
$a = array_multisort(array_column($flights,'departure_icao'), $flights);
I have read (and tried) the several examples given in similar posts. Just keep getting errors.
New contributor
Timothy Treaster is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.