3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function getFunc($turn) { static $enable = $turn; //$enable = $turn; return function($str) use (&$enable) { if ($enable) { echo $str; } }; } public function run() { $func = $this->getFunc(true); $func('ok'); echo PHP_EOL.'---------------'.PHP_EOL; $this->getFunc(false); $func('not ok'); $this->getFunc(true); $func('--ok--'); } } $test = new Test(); $test->run();

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)
5.4.270.0200.06718.97
5.4.260.0130.07018.90
5.4.250.0300.06018.95
5.4.240.0030.05318.98
5.4.230.0170.04718.74
5.4.220.0200.05018.84
5.4.210.0170.06318.65
5.4.200.0100.07318.98
5.4.190.0200.04318.94
5.4.180.0200.04718.99
5.4.170.0130.04718.96
5.4.160.0100.07718.98
5.4.150.0130.06318.79
5.4.140.0170.06316.59
5.4.130.0070.07316.58
5.4.120.0070.07016.54
5.4.110.0100.05016.50
5.4.100.0100.04716.42
5.4.90.0130.06316.53
5.4.80.0130.06016.41
5.4.70.0170.06016.46
5.4.60.0130.05016.35
5.4.50.0170.06316.48
5.4.40.0070.05016.57
5.4.30.0170.06716.50
5.4.20.0000.07016.52
5.4.10.0130.07016.54
5.4.00.0030.07315.92
5.3.280.0130.06714.61
5.3.270.0030.07014.77
5.3.260.0130.05714.69
5.3.250.0100.05014.57
5.3.240.0030.08014.77
5.3.230.0130.06714.67
5.3.220.0070.05314.48
5.3.210.0130.07314.75
5.3.200.0070.06714.55
5.3.190.0030.05714.56
5.3.180.0070.05014.47
5.3.170.0100.05014.70
5.3.160.0100.07314.56
5.3.150.0070.06714.74
5.3.140.0070.05714.64
5.3.130.0130.06714.53
5.3.120.0130.06314.38
5.3.110.0100.05314.68
5.3.100.0070.06714.02
5.3.90.0100.04714.03
5.3.80.0200.05714.02
5.3.70.0100.05014.11
5.3.60.0070.07013.98
5.3.50.0000.05713.86
5.3.40.0100.05713.86
5.3.30.0000.05314.09
5.3.20.0170.04313.68
5.3.10.0070.07013.64
5.3.00.0070.05313.71
5.2.170.0230.05310.97
5.2.160.0030.04711.12
5.2.150.0100.03711.21
5.2.140.0030.04311.23
5.2.130.0000.04711.19
5.2.120.0070.05711.06
5.2.110.0130.04011.00
5.2.100.0100.03711.17
5.2.90.0070.03711.05
5.2.80.0030.04311.09
5.2.70.0070.04311.15
5.2.60.0070.04011.23
5.2.50.0030.04311.09
5.2.40.0070.04311.22
5.2.30.0070.04711.13
5.2.20.0070.04311.11
5.2.10.0100.03310.86
5.2.00.0070.04010.72
5.1.60.0100.03010.15
5.1.50.0070.0439.98
5.1.40.0070.03710.07
5.1.30.0130.04010.32
5.1.20.0070.05310.51
5.1.10.0030.05010.04
5.1.00.0200.02710.14
5.0.50.0030.0408.51
5.0.40.0030.0338.45
5.0.30.0170.0438.20
5.0.20.0030.0378.34
5.0.10.0070.0378.16
5.0.00.0030.0538.11
4.4.90.0070.0177.20
4.4.80.0070.0177.20
4.4.70.0030.0277.20
4.4.60.0030.0237.20
4.4.50.0030.0277.20
4.4.40.0030.0337.20
4.4.30.0030.0277.20
4.4.20.0030.0207.20
4.4.10.0070.0177.20
4.4.00.0000.0377.20
4.3.110.0000.0237.20
4.3.100.0070.0207.20
4.3.90.0000.0237.20
4.3.80.0000.0337.20
4.3.70.0000.0237.20
4.3.60.0000.0207.20
4.3.50.0030.0237.20
4.3.40.0030.0407.20
4.3.30.0030.0207.20
4.3.20.0030.0237.20
4.3.10.0030.0207.20
4.3.00.0030.0205.90

preferences:
145.57 ms | 1386 KiB | 7 Q