3v4l.org

run code in 300+ PHP versions simultaneously
<?php class X { public function each($function) { for($i=0; $i<3; $i++) { call_user_func($function, $i); } } public function isEqual($value, &$a = null, &$b = null) { $a = $value; $b = 1; return $a == $b; } public function action($force = false) { $this->each(function($i) { if (isEqual($i, $a, $b) || $force) { echo $i . PHP_EOL; } } } } $a = new X(); $a->action(); $a->action(true);

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.0.00.0030.08720.07
5.6.160.0070.04320.47
5.6.150.0030.08018.29
5.6.140.0100.06018.16
5.6.130.0170.07318.21
5.6.120.0030.04021.15
5.6.110.0000.04321.16
5.6.100.0100.07021.15
5.6.90.0070.03721.09
5.6.80.0030.08020.35
5.5.300.0100.06318.09
5.5.290.0070.07318.07
5.5.280.0000.05320.82
5.5.270.0170.07320.88
5.5.260.0070.08320.88
5.5.250.0030.05720.70
5.5.240.0170.06020.14

preferences:
145.32 ms | 1394 KiB | 7 Q