3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "Starting in_array\n"; $limit = 40000; $arr = [30, 367]; $time = microtime(true); for($i = 0; $i < $limit; ++$i) { if (in_array($i, $arr)) { } } $time = microtime(true) - $time; echo 'in_array() took ' . number_format($time, 3) . " seconds\n"; $time = microtime(true); for($i = 0; $i < $limit; ++$i) { if ($i === 30 || $i === 367) { } } $time = microtime(true) - $time; echo '=== took ' . number_format($time, 3) . " seconds\n";

preferences:
35.16 ms | 402 KiB | 5 Q