3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class callable { public function __invoke($a = 0) { return $a++; } } $c = new callable(); $t = microtime(true); $sum = 0; for ($i = 0; $i < 100000; $i++) { $sum += $c->__invoke($i); } printf("time=%f [%d]\n", microtime(true) - $t, $sum); $t = microtime(true); $sum = 0; for ($i = 0; $i < 100000; $i++) { $sum += $c($i); } printf("time=%f [%d]\n", microtime(true) - $t, $sum);
Output for 5.4.0 - 5.4.13
Parse error: syntax error, unexpected 'callable' (T_CALLABLE), expecting identifier (T_STRING) in /in/mJvO9 on line 3
Process exited with code 255.
Output for 5.3.29
time=0.025709 [4999950000] time=0.017581 [4999950000]
Output for 5.3.28
time=0.026904 [4999950000] time=0.022274 [4999950000]
Output for 5.3.27
time=0.029634 [4999950000] time=0.021008 [4999950000]
Output for 5.3.26
time=0.022393 [4999950000] time=0.016066 [4999950000]
Output for 5.3.25
time=0.024244 [4999950000] time=0.020417 [4999950000]
Output for 5.3.24
time=0.025296 [4999950000] time=0.021527 [4999950000]
Output for 5.3.23
time=0.024532 [4999950000] time=0.020420 [4999950000]
Output for 5.3.22
time=0.023956 [4999950000] time=0.018682 [4999950000]
Output for 5.3.21
time=0.021231 [4999950000] time=0.017304 [4999950000]
Output for 5.3.20
time=0.024398 [4999950000] time=0.018205 [4999950000]
Output for 5.3.19
time=0.024685 [4999950000] time=0.019224 [4999950000]
Output for 5.3.18
time=0.029754 [4999950000] time=0.025243 [4999950000]
Output for 5.3.17
time=0.022089 [4999950000] time=0.018655 [4999950000]
Output for 5.3.16
time=0.017879 [4999950000] time=0.016130 [4999950000]
Output for 5.3.15
time=0.025897 [4999950000] time=0.022854 [4999950000]
Output for 5.3.14
time=0.017740 [4999950000] time=0.016304 [4999950000]
Output for 5.3.13
time=0.024590 [4999950000] time=0.022221 [4999950000]
Output for 5.3.12
time=0.027663 [4999950000] time=0.022569 [4999950000]
Output for 5.3.11
time=0.019441 [4999950000] time=0.017796 [4999950000]
Output for 5.3.10
time=0.023564 [4999950000] time=0.021476 [4999950000]
Output for 5.3.9
time=0.017325 [4999950000] time=0.016022 [4999950000]
Output for 5.3.8
time=0.017760 [4999950000] time=0.015616 [4999950000]
Output for 5.3.7
time=0.017718 [4999950000] time=0.015983 [4999950000]
Output for 5.3.6
time=0.017526 [4999950000] time=0.015945 [4999950000]
Output for 5.3.5
time=0.018025 [4999950000] time=0.016512 [4999950000]
Output for 5.3.4
time=0.017808 [4999950000] time=0.016092 [4999950000]
Output for 5.3.3
time=0.017181 [4999950000] time=0.015669 [4999950000]
Output for 5.3.2
time=0.016789 [4999950000] time=0.015439 [4999950000]
Output for 5.3.1
time=0.017137 [4999950000] time=0.016113 [4999950000]
Output for 5.3.0
time=0.019632 [4999950000] time=0.016420 [4999950000]