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.28, 8.4.1 - 8.4.14, 8.5.0
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 ) ) )
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
165.72 ms | 408 KiB | 5 Q