<?php
$array = [
'id93294' => [
'Name' => 'Tom Anderson 2',
'Birthday' => '03/17/1975',
'Hometown' => 'The Matrix',
'CurrentLocation' => 'The Matrix'
],
'id29349' => [
'Name' => 'Tom Anderson 1',
'Birthday' => '03/17/1975',
'Hometown' => 'The Matrix',
'CurrentLocation' => 'The Matrix'
],
'id29348' => [
'Name' => 'Neo',
'Birthday' => '03/17/1975',
'Hometown' => 'The Matrix',
'CurrentLocation' => 'The Real World'
],
'id29346' => [
'Name' => 'Neo',
'Birthday' => '03/17/1975',
'Hometown' => 'The Matrix',
'CurrentLocation' => 'Zion'
],
'id29338' => [
'Name' => 'Tank',
'Birthday' => '04/20/1973',
'Hometown' => 'Zion',
'CurrentLocation' => 'Zion'
],
'id29342' => [
'Name' => 'Trinity',
'Birthday' => '08/09/1979',
'Hometown' => 'The Matrix',
'CurrentLocation' => 'The Real World'
]
];
uasort($array, function($a, $b) {
return [strtotime($a['Birthday']), $a['Hometown'] !== $a['CurrentLocation'], $a['Name']]
<=>
[strtotime($b['Birthday']), $b['Hometown'] !== $b['CurrentLocation'], $b['Name']];
});
var_export($array);
preferences:
23.77 ms | 406 KiB | 5 Q