I have an array that needs sorted by ‘yes’ and ‘no’ keys – how might this be done in PHP? Specifically I would like all yes’s to be first index (there will only ever be 1 yes and many no’s)
Array (
[0] => Array
(
[no] => Array
(
[0] => 379
)
[yes] => Array
(
[1] => 370
)
)
[1] => Array
(
[yes] => Array
(
[0] => 372
)
)
[2] => Array
(
[no] => Array
(
[0] => 377
)
[yes] => Array
(
[1] => 374
)
)
)
You can use
uksortto sort an array according to its keys using a custom comparison function: