3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 3 => 1, 7 => 2, 5 => 3, 2 => 4, 0 => 5 ]; echo max(array_keys($array)); // 4 echo sizeof($array)-1; // 4 echo array_search(max($array), $array); // 4
Output for 7.3.0 - 7.3.31, 7.4.0 - 7.4.25, 8.0.0 - 8.0.12, 8.1rc1 - rc3
740

preferences:
37.66 ms | 460 KiB | 5 Q