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.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
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:
115.09 ms | 1859 KiB | 4 Q