3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function benchmark($function, $args=null, $count=1) { $time = microtime(1); for($i=0; $i<$count; $i++) { $result = is_array($args)? call_user_func_array($function, $args): call_user_func_array($function); } return array( 'total_time' => microtime(1) - $time, 'average_time' => (microtime(1) - $time)/$count, 'count' => $count ); } function p($string) { print_r($string . "<br>"); } var_dump(benchmark('p', array('test',1E4))); gc_collect_cycles(); //var_dump(benchmark('p', array('test',1E3)));
Output for 7.0.3, 7.1.0
test<br>array(3) { ["total_time"]=> float(1.4066696166992E-5) ["average_time"]=> float(1.5020370483398E-5) ["count"]=> int(1) }
Output for 7.0.6 - 7.0.14
test<br>array(3) { ["total_time"]=> float(2.288818359375E-5) ["average_time"]=> float(2.3841857910156E-5) ["count"]=> int(1) }
Output for 5.4.40, 5.5.33, 5.5.35, 5.6.19, 7.0.5
test<br>array(3) { ["total_time"]=> float(2.0027160644531E-5) ["average_time"]=> float(2.0980834960938E-5) ["count"]=> int(1) }
Output for 7.0.4
test<br>array(3) { ["total_time"]=> float(2.0027160644531E-5) ["average_time"]=> float(2.4080276489258E-5) ["count"]=> int(1) }
Output for 5.3.1 - 5.3.2, 5.4.38, 7.0.2
test<br>array(3) { ["total_time"]=> float(1.8119812011719E-5) ["average_time"]=> float(1.9073486328125E-5) ["count"]=> int(1) }
Output for 7.0.1
test<br>array(3) { ["total_time"]=> float(1.7881393432617E-5) ["average_time"]=> float(1.7881393432617E-5) ["count"]=> int(1) }
Output for 5.3.3 - 5.3.5, 5.3.10, 5.3.25, 5.3.28 - 5.3.29, 5.4.1, 5.4.8, 5.4.11 - 5.4.12, 5.4.15, 5.4.17, 5.4.28, 5.4.36, 5.4.41, 7.0.0
test<br>array(3) { ["total_time"]=> float(1.5974044799805E-5) ["average_time"]=> float(1.6927719116211E-5) ["count"]=> int(1) }
Output for hhvm-3.12.0
test<br>array(3) { ["total_time"]=> float(3.6001205444336E-5) ["average_time"]=> float(3.6954879760742E-5) ["count"]=> int(1) }
Output for 5.5.32, hhvm-3.10.0
test<br>array(3) { ["total_time"]=> float(3.0040740966797E-5) ["average_time"]=> float(3.0994415283203E-5) ["count"]=> int(1) }
Output for 5.6.28
test<br>array(3) { ["total_time"]=> float(2.4080276489258E-5) ["average_time"]=> float(2.5033950805664E-5) ["count"]=> int(1) }
Output for 5.6.21
test<br>array(3) { ["total_time"]=> float(2.6226043701172E-5) ["average_time"]=> float(2.7179718017578E-5) ["count"]=> int(1) }
Output for 5.6.16, 5.6.20
test<br>array(3) { ["total_time"]=> float(1.8835067749023E-5) ["average_time"]=> float(1.8835067749023E-5) ["count"]=> int(1) }
Output for 5.4.19, 5.6.18
test<br>array(3) { ["total_time"]=> float(1.7881393432617E-5) ["average_time"]=> float(1.9073486328125E-5) ["count"]=> int(1) }
Output for 5.3.12, 5.5.29, 5.6.17
test<br>array(3) { ["total_time"]=> float(1.7881393432617E-5) ["average_time"]=> float(1.8835067749023E-5) ["count"]=> int(1) }
Output for 5.6.11, 5.6.15
test<br>array(3) { ["total_time"]=> float(1.9073486328125E-5) ["average_time"]=> float(2.0027160644531E-5) ["count"]=> int(1) }
Output for 5.6.14
test<br>array(3) { ["total_time"]=> float(1.8835067749023E-5) ["average_time"]=> float(2.0027160644531E-5) ["count"]=> int(1) }
Output for 5.4.2, 5.4.16, 5.6.13
test<br>array(3) { ["total_time"]=> float(1.5974044799805E-5) ["average_time"]=> float(1.5974044799805E-5) ["count"]=> int(1) }
Output for 5.6.12
test<br>array(3) { ["total_time"]=> float(2.7179718017578E-5) ["average_time"]=> float(2.8133392333984E-5) ["count"]=> int(1) }
Output for 5.4.44, 5.5.24 - 5.5.26, 5.6.9 - 5.6.10
test<br>array(3) { ["total_time"]=> float(2.5033950805664E-5) ["average_time"]=> float(2.598762512207E-5) ["count"]=> int(1) }
Output for 5.6.8
test<br>array(3) { ["total_time"]=> float(2.1934509277344E-5) ["average_time"]=> float(2.288818359375E-5) ["count"]=> int(1) }
Output for 5.3.0, 5.3.13, 5.3.15, 5.3.20, 5.4.4, 5.4.6, 5.4.20, 5.4.24, 5.6.7
test<br>array(3) { ["total_time"]=> float(1.6927719116211E-5) ["average_time"]=> float(1.7881393432617E-5) ["count"]=> int(1) }
Output for 5.5.34
test<br>array(3) { ["total_time"]=> float(2.288818359375E-5) ["average_time"]=> float(2.4080276489258E-5) ["count"]=> int(1) }
Output for 5.5.31
test<br>array(3) { ["total_time"]=> float(2.4795532226562E-5) ["average_time"]=> float(2.6941299438477E-5) ["count"]=> int(1) }
Output for 5.5.30
test<br>array(3) { ["total_time"]=> float(2.4080276489258E-5) ["average_time"]=> float(2.598762512207E-5) ["count"]=> int(1) }
Output for 5.3.23, 5.4.37, 5.4.39, 5.5.27 - 5.5.28
test<br>array(3) { ["total_time"]=> float(2.0980834960938E-5) ["average_time"]=> float(2.1934509277344E-5) ["count"]=> int(1) }
Output for 5.3.9, 5.4.45
test<br>array(3) { ["total_time"]=> float(1.5020370483398E-5) ["average_time"]=> float(1.6212463378906E-5) ["count"]=> int(1) }
Output for 5.3.14, 5.3.24, 5.3.27, 5.4.13, 5.4.42 - 5.4.43
test<br>array(3) { ["total_time"]=> float(1.7166137695312E-5) ["average_time"]=> float(1.8119812011719E-5) ["count"]=> int(1) }
Output for 5.4.35
test<br>array(3) { ["total_time"]=> float(1.6927719116211E-5) ["average_time"]=> float(1.6927719116211E-5) ["count"]=> int(1) }
Output for 5.3.11, 5.4.3, 5.4.21, 5.4.34
test<br>array(3) { ["total_time"]=> float(1.5974044799805E-5) ["average_time"]=> float(1.7166137695312E-5) ["count"]=> int(1) }
Output for 5.3.21, 5.4.0, 5.4.10, 5.4.14, 5.4.25, 5.4.31 - 5.4.32
test<br>array(3) { ["total_time"]=> float(1.5020370483398E-5) ["average_time"]=> float(1.5974044799805E-5) ["count"]=> int(1) }
Output for 5.3.17, 5.4.9, 5.4.30
test<br>array(3) { ["total_time"]=> float(1.7166137695312E-5) ["average_time"]=> float(1.7166137695312E-5) ["count"]=> int(1) }
Output for 5.3.6, 5.3.16, 5.4.7, 5.4.23, 5.4.29
test<br>array(3) { ["total_time"]=> float(1.6212463378906E-5) ["average_time"]=> float(1.7166137695312E-5) ["count"]=> int(1) }
Output for 5.4.27
test<br>array(3) { ["total_time"]=> float(1.4781951904297E-5) ["average_time"]=> float(1.5974044799805E-5) ["count"]=> int(1) }
Output for 5.4.26
test<br>array(3) { ["total_time"]=> float(1.6212463378906E-5) ["average_time"]=> float(1.6212463378906E-5) ["count"]=> int(1) }
Output for 5.4.22
test<br>array(3) { ["total_time"]=> float(1.978874206543E-5) ["average_time"]=> float(2.1934509277344E-5) ["count"]=> int(1) }
Output for 5.4.18
test<br>array(3) { ["total_time"]=> float(1.5020370483398E-5) ["average_time"]=> float(1.5020370483398E-5) ["count"]=> int(1) }
Output for 5.4.5
test<br>array(3) { ["total_time"]=> float(2.2172927856445E-5) ["average_time"]=> float(2.3126602172852E-5) ["count"]=> int(1) }
Output for 5.3.26
test<br>array(3) { ["total_time"]=> float(2.0027160644531E-5) ["average_time"]=> float(2.1934509277344E-5) ["count"]=> int(1) }
Output for 5.3.18, 5.3.22
test<br>array(3) { ["total_time"]=> float(1.6927719116211E-5) ["average_time"]=> float(1.8119812011719E-5) ["count"]=> int(1) }
Output for 5.3.19
test<br>array(3) { ["total_time"]=> float(2.1219253540039E-5) ["average_time"]=> float(2.2172927856445E-5) ["count"]=> int(1) }
Output for 5.3.8
test<br>array(3) { ["total_time"]=> float(2.1934509277344E-5) ["average_time"]=> float(2.3841857910156E-5) ["count"]=> int(1) }
Output for 5.3.7
test<br>array(3) { ["total_time"]=> float(1.5974044799805E-5) ["average_time"]=> float(1.8119812011719E-5) ["count"]=> int(1) }
Output for 5.2.17
test<br>array(3) { ["total_time"]=> float(1.7166137695312E-5) ["average_time"]=> float(1.8119812011719E-5) ["count"]=> int(1) } Fatal error: Call to undefined function gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 5.2.3, 5.2.16
test<br>array(3) { ["total_time"]=> float(2.0980834960938E-5) ["average_time"]=> float(2.1934509277344E-5) ["count"]=> int(1) } Fatal error: Call to undefined function gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 5.1.6, 5.2.14 - 5.2.15
test<br>array(3) { ["total_time"]=> float(1.5974044799805E-5) ["average_time"]=> float(1.5974044799805E-5) ["count"]=> int(1) } Fatal error: Call to undefined function gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 5.2.10, 5.2.13
test<br>array(3) { ["total_time"]=> float(2.0027160644531E-5) ["average_time"]=> float(2.0980834960938E-5) ["count"]=> int(1) } Fatal error: Call to undefined function gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 5.0.2, 5.2.0, 5.2.12
test<br>array(3) { ["total_time"]=> float(1.5974044799805E-5) ["average_time"]=> float(1.6927719116211E-5) ["count"]=> int(1) } Fatal error: Call to undefined function gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 5.0.4, 5.2.2, 5.2.11
test<br>array(3) { ["total_time"]=> float(2.1934509277344E-5) ["average_time"]=> float(2.288818359375E-5) ["count"]=> int(1) } Fatal error: Call to undefined function gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 5.2.9
test<br>array(3) { ["total_time"]=> float(2.0027160644531E-5) ["average_time"]=> float(2.1934509277344E-5) ["count"]=> int(1) } Fatal error: Call to undefined function gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 5.2.8
test<br>array(3) { ["total_time"]=> float(3.3855438232422E-5) ["average_time"]=> float(3.6001205444336E-5) ["count"]=> int(1) } Fatal error: Call to undefined function gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 5.1.5, 5.2.7
test<br>array(3) { ["total_time"]=> float(2.4080276489258E-5) ["average_time"]=> float(2.5033950805664E-5) ["count"]=> int(1) } Fatal error: Call to undefined function gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 5.0.5, 5.2.6
test<br>array(3) { ["total_time"]=> float(1.6927719116211E-5) ["average_time"]=> float(1.8119812011719E-5) ["count"]=> int(1) } Fatal error: Call to undefined function gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 5.2.5
test<br>array(3) { ["total_time"]=> float(2.5033950805664E-5) ["average_time"]=> float(2.7179718017578E-5) ["count"]=> int(1) } Fatal error: Call to undefined function gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 5.2.4
test<br>array(3) { ["total_time"]=> float(1.7881393432617E-5) ["average_time"]=> float(1.9073486328125E-5) ["count"]=> int(1) } Fatal error: Call to undefined function gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 5.2.1
test<br>array(3) { ["total_time"]=> float(1.4066696166992E-5) ["average_time"]=> float(1.5020370483398E-5) ["count"]=> int(1) } Fatal error: Call to undefined function gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 5.1.4
test<br>array(3) { ["total_time"]=> float(2.9087066650391E-5) ["average_time"]=> float(3.0040740966797E-5) ["count"]=> int(1) } Fatal error: Call to undefined function gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 5.1.3
test<br>array(3) { ["total_time"]=> float(1.9073486328125E-5) ["average_time"]=> float(2.0027160644531E-5) ["count"]=> int(1) } Fatal error: Call to undefined function gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 5.1.2
test<br>array(3) { ["total_time"]=> float(2.1219253540039E-5) ["average_time"]=> float(2.2172927856445E-5) ["count"]=> int(1) } Fatal error: Call to undefined function gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 5.0.0, 5.0.3, 5.1.1
test<br>array(3) { ["total_time"]=> float(1.6927719116211E-5) ["average_time"]=> float(1.7881393432617E-5) ["count"]=> int(1) } Fatal error: Call to undefined function gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/mkkJt on line 24
Process exited with code 255.
Output for 5.0.1
test<br>array(3) { ["total_time"]=> float(1.7166137695313E-5) ["average_time"]=> float(1.8119812011719E-5) ["count"]=> int(1) } Fatal error: Call to undefined function gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 4.4.6, 4.4.9
test<br>array(3) { ["total_time"]=> float(1.8000000000074E-5) ["average_time"]=> float(2.000000000002E-5) ["count"]=> int(1) } Fatal error: Call to undefined function: gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 4.4.7 - 4.4.8
test<br>array(3) { ["total_time"]=> float(2.000000000002E-5) ["average_time"]=> float(2.1999999999966E-5) ["count"]=> int(1) } Fatal error: Call to undefined function: gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 4.4.5
test<br>array(3) { ["total_time"]=> float(2.1999999999966E-5) ["average_time"]=> float(2.4000000000024E-5) ["count"]=> int(1) } Fatal error: Call to undefined function: gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 4.4.4
test<br>array(3) { ["total_time"]=> float(2.9999999999974E-5) ["average_time"]=> float(3.4999999999979E-5) ["count"]=> int(1) } Fatal error: Call to undefined function: gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 4.4.3
test<br>array(3) { ["total_time"]=> float(2.4000000000024E-5) ["average_time"]=> float(2.599999999997E-5) ["count"]=> int(1) } Fatal error: Call to undefined function: gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 4.4.2
test<br>array(3) { ["total_time"]=> float(1.9000000000005E-5) ["average_time"]=> float(2.1000000000007E-5) ["count"]=> int(1) } Fatal error: Call to undefined function: gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 4.4.1
test<br>array(3) { ["total_time"]=> float(1.8999999999991E-5) ["average_time"]=> float(2.1000000000049E-5) ["count"]=> int(1) } Fatal error: Call to undefined function: gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 4.4.0
test<br>array(3) { ["total_time"]=> float(2.1000000000049E-5) ["average_time"]=> float(2.2999999999995E-5) ["count"]=> int(1) } Fatal error: Call to undefined function: gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 4.3.11
test<br>array(3) { ["total_time"]=> float(2.6999999999999E-5) ["average_time"]=> float(2.9999999999974E-5) ["count"]=> int(1) } Fatal error: Call to undefined function: gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 4.3.10
test<br>array(3) { ["total_time"]=> float(1.6999999999989E-5) ["average_time"]=> float(1.8999999999991E-5) ["count"]=> int(1) } Fatal error: Call to undefined function: gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 4.3.9
test<br>array(3) { ["total_time"]=> float(1.8999999999991E-5) ["average_time"]=> float(2.2000000000022E-5) ["count"]=> int(1) } Fatal error: Call to undefined function: gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 4.3.8
test<br>array(3) { ["total_time"]=> float(3.6999999999954E-5) ["average_time"]=> float(4.0999999999958E-5) ["count"]=> int(1) } Fatal error: Call to undefined function: gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 4.3.7
test<br>array(3) { ["total_time"]=> float(2.8999999999946E-5) ["average_time"]=> float(3.6000000000036E-5) ["count"]=> int(1) } Fatal error: Call to undefined function: gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 4.3.6
test<br>array(3) { ["total_time"]=> float(1.9999999999999E-5) ["average_time"]=> float(2.2999999999999E-5) ["count"]=> int(1) } Fatal error: Call to undefined function: gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 4.3.5
test<br>array(3) { ["total_time"]=> float(1.9999999999992E-5) ["average_time"]=> float(2.2999999999995E-5) ["count"]=> int(1) } Fatal error: Call to undefined function: gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 4.3.4
test<br>array(3) { ["total_time"]=> float(2.000000000002E-5) ["average_time"]=> float(2.2999999999995E-5) ["count"]=> int(1) } Fatal error: Call to undefined function: gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 4.3.3
test<br>array(3) { ["total_time"]=> float(1.7000000000045E-5) ["average_time"]=> float(2.000000000002E-5) ["count"]=> int(1) } Fatal error: Call to undefined function: gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 4.3.2
test<br>array(3) { ["total_time"]=> float(1.8000000000074E-5) ["average_time"]=> float(2.1000000000049E-5) ["count"]=> int(1) } Fatal error: Call to undefined function: gc_collect_cycles() in /in/mkkJt on line 23
Process exited with code 255.
Output for 4.3.1
test<br>array(3) { ["total_time"]=> float(1.8999999999991E-5) ["average_time"]=> float(2.1999999999966E-5) ["count"]=> int(1) } Fatal error: Call to undefined function: gc_collect_cycles() in /in/mkkJt on line 23
Output for 4.3.0
test<br>array(3) { ["total_time"]=> float(2.1999999999966E-5) ["average_time"]=> float(2.7999999999917E-5) ["count"]=> int(1) } Fatal error: Call to undefined function: gc_collect_cycles() in /in/mkkJt on line 23