3v4l.org

run code in 300+ PHP versions simultaneously
<?php $value = 53; $items = array(1, 22, 77, 53, 34, 51, 56); $runtimes = 0; function find($needle, array $haystack, $cursor = 0) { $GLOBAL['runtimes'] ++; if (!isset($haystack[$cursor])) { return false; } if ($needle === $haystack[$cursor]) { return $cursor; } return find($needle, $haystack, $cursor + 1); } $retval = find($value, $items); printf($runtimes . PHP_EOL); var_dump($retval);

preferences:
51.87 ms | 402 KiB | 5 Q