3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = range(1,1000000); $t = microtime(true); foreach($a as $e) { $b = $e; } $t -= microtime(true); echo 'foreach time: ', $t, PHP_EOL; $t = microtime(true); array_walk($a, function($e) { $b = $e; }); $t -= microtime(true); echo 'array_walk time: ', $t, PHP_EOL; $t = microtime(true); array_map(function($e) { $b = $e; }, $a); $t -= microtime(true); echo 'Array_map time: ', $t, PHP_EOL;
based on CECpP
Output for 7.1.0
foreach time: -0.020437955856323 array_walk time: -0.085299015045166 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/JidLc on line 15
Process exited with code 255.
Output for 7.0.14
foreach time: -0.015960931777954 array_walk time: -0.070314168930054 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/JidLc on line 15
Process exited with code 255.
Output for 7.0.6
foreach time: -0.014402151107788 array_walk time: -0.082261085510254 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/JidLc on line 15
Process exited with code 255.
Output for 7.0.5
foreach time: -0.011507034301758 array_walk time: -0.093137979507446 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/JidLc on line 15
Process exited with code 255.
Output for 7.0.4
foreach time: -0.011234998703003 array_walk time: -0.080400943756104 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/JidLc on line 15
Process exited with code 255.
Output for 7.0.3
foreach time: -0.009833812713623 array_walk time: -0.074243068695068 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/JidLc on line 15
Process exited with code 255.
Output for 7.0.2
foreach time: -0.011779069900513 array_walk time: -0.089514017105103 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/JidLc on line 15
Process exited with code 255.
Output for 7.0.1
foreach time: -0.011147022247314 array_walk time: -0.066043853759766 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/JidLc on line 15
Process exited with code 255.
Output for 7.0.0
foreach time: -0.013710975646973 array_walk time: -0.079051971435547 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/JidLc on line 15
Process exited with code 255.
Output for 5.3.0 - 5.6.28
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes) in /in/JidLc on line 2
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/JidLc on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/JidLc on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/JidLc on line 10
Process exited with code 255.