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

preferences:
12.66 ms | 460 KiB | 5 Q