3v4l.org

run code in 300+ PHP versions simultaneously
<?php for ($a = 0; $a < 5; $a++) { $start = microtime(true); for ($i = 0; $i < 10000; $i++) { $args = ['a', 'b']; foreach ($args as $arg) { $arg = (string)$arg; } } echo round(microtime(true) - $start, 5) . PHP_EOL; $start = microtime(true); for ($i = 0; $i < 10000; $i++) { $args = ['a', 'b']; while (count($args)) { $arg = (string)array_shift($args); } } echo round(microtime(true) - $start, 5) . PHP_EOL; }

preferences:
34.42 ms | 402 KiB | 5 Q