3v4l.org

run code in 300+ PHP versions simultaneously
<?php //https://github.com/php/php-src/blob/master/Zend/micro_bench.php function hallo() {} function hallo2() {} function simpleucall($n) { for ($i = 0; $i < $n; $i++) hallo(); } function simpleudcall($n) { for ($i = 0; $i < $n; $i++) hallo2(); } function simpleicall($n) { for ($i = 0; $i < $n; $i++) func_num_args(); } define('TEST', null); function read_const($n) { for ($i = 0; $i < $n; ++$i) $x = TEST; } function read_auto_global($n) { for ($i = 0; $i < $n; ++$i) $x = $_GET; } $g_var = 0; function read_global_var($n) { for ($i = 0; $i < $n; ++$i) $x = $GLOBALS['g_var']; } function read_hash($n) { $hash = array('test' => 0); for ($i = 0; $i < $n; ++$i) $x = $hash['test'];} function read_str_offset($n) { $str = "test"; for ($i = 0; $i < $n; ++$i) $x = $str[1]; } function ternary($n) { $val = array(0,1,2,3,4,5,6,7,8,9); $f = false; for ($i = 0; $i < $n; ++$i) $x = $f ? null : $val; } function ternary2($n) { $f = false; $j = 0; for ($i = 0; $i < $n; ++$i) $x = $f ? $f : $j + 1; } /*****/ function getmicrotime() { $t = gettimeofday(); return ($t['sec'] + $t['usec'] / 1000000);} define("N", 50000); simpleucall(N); simpleudcall(N); simpleicall(N); read_const(N); read_auto_global(N); read_global_var(N); read_hash(N); read_str_offset(N); ternary(N); ternary2(N);
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.35, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0 - 7.2.33, 7.3.12 - 7.3.30, 7.4.0 - 7.4.24, 8.0.0 - 8.0.11

preferences:
170.08 ms | 405 KiB | 259 Q