3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array ( 0 => array ( 0 => array ( 'personNum' => 2, 'type' => 'comment', 'datetime' => '2019-05-15 11:29:45' ), 1 => array ( 'personNum' => 3, 'type' => 'status', 'datetime' => '2019-05-26 15:59:53' ) ), 1 => array ( 0 => array ( 'personNum' => 3, 'type' => 'status', 'datetime' => '2019-05-26 15:59:53' ), 1 => array ( 'personNum' => 4, 'type' => 'status', 'datetime' => '2019-05-26 16:04:24' ), ) ); array_walk($arr, function (&$v) { array_multisort(array_column($v, 'datetime'), SORT_DESC, $v); }); usort($arr, function ($a, $b) { return strcmp(max(array_column($b, 'datetime')), max(array_column($a, 'datetime'))); }); print_r($arr);
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.27, 8.4.1 - 8.4.14
Array ( [0] => Array ( [0] => Array ( [personNum] => 4 [type] => status [datetime] => 2019-05-26 16:04:24 ) [1] => Array ( [personNum] => 3 [type] => status [datetime] => 2019-05-26 15:59:53 ) ) [1] => Array ( [0] => Array ( [personNum] => 3 [type] => status [datetime] => 2019-05-26 15:59:53 ) [1] => Array ( [personNum] => 2 [type] => comment [datetime] => 2019-05-15 11:29:45 ) ) )

preferences:
139.44 ms | 410 KiB | 5 Q