3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ["2" => 6, "5" => 1], ["2" => 1, "5" => 3], ]; var_export( array_reduce( $array, fn($result, $row) => array_reduce( array_keys($row), fn($res, $k) => isset($res[$k]) && $res[$k] >= $row[$k] ? $res : array_replace($res, [$k => $row[$k]]), $result ), [] ) );
Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.13
array ( 2 => 6, 5 => 3, )

preferences:
63.73 ms | 406 KiB | 5 Q