3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $bar; public function init($callable) { $callable($this, $this->bar); } public function setBar($bar) { $this->bar = $bar; } } $a = new A(); $callable1 = function($obj, &$bar) { $obj->bar = 'foo'; }; $callable2 = function($obj, &$bar) { $obj->setBar('foo'); }; foreach (array($callable1, $callable2) as $cb) { $start = microtime(true); for ($i = 0; $i < 100000; $i += 1) { $a->init($cb); } var_dump(microtime(true) - $start); }

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.2.00.0030.03019.56
7.1.70.0000.03216.93
7.1.60.0070.05319.40
7.1.50.0100.05617.02
7.1.00.0030.10322.35
7.0.200.0000.03216.52
7.0.140.0100.09722.19
7.0.120.0070.10722.04
7.0.60.0070.10320.06
7.0.50.0000.06317.95
7.0.40.0030.08320.09
7.0.30.0330.10020.33
7.0.20.0230.09020.12
7.0.10.0100.11320.17
7.0.00.0100.10320.16
5.6.280.0030.17020.91
5.6.210.0170.13720.79
5.6.200.0000.11718.22
5.6.190.0100.15020.48
5.6.180.0170.09320.64
5.6.170.0270.14320.43
5.6.160.0070.13320.46
5.6.150.0030.16718.18
5.6.140.0030.15318.23
5.6.130.0030.16018.18
5.6.120.0030.10721.03
5.6.110.0070.14720.90
5.6.100.0100.13720.99
5.6.90.0130.09721.01
5.6.80.0000.16020.39
5.5.350.0030.13020.39
5.5.340.0100.13018.09
5.5.330.0000.10720.13
5.5.320.0230.11320.30
5.5.310.0230.14720.34
5.5.300.0000.10018.08
5.5.290.0070.14018.03
5.5.280.0100.16020.78
5.5.270.0030.12720.80
5.5.260.0030.10020.64
5.5.250.0100.10320.80
5.5.240.0230.07320.20
5.4.450.0170.14719.50
5.4.440.0030.15019.25
5.4.430.0030.15719.17
5.4.420.0170.14319.19
5.4.410.0130.15319.34
5.4.400.0100.14018.95
5.4.390.0100.14019.17
5.4.380.0070.15718.84
5.4.370.0100.12319.18
5.4.360.0070.15019.21
5.4.350.0030.09718.96
5.4.340.0070.13318.92
5.4.320.0030.09318.87
5.4.310.0070.10719.20
5.4.300.0000.09319.12
5.4.290.0100.08319.14
5.4.280.0000.09319.15
5.4.270.0100.09018.85
5.4.260.0130.08719.08
5.4.250.0000.09318.86
5.4.240.0000.11019.24
5.4.230.0070.08718.91
5.4.220.0070.08719.26
5.4.210.0030.09019.11
5.4.200.0030.09019.24
5.4.190.0070.15019.14
5.4.180.0070.14718.95
5.4.170.0100.16019.00
5.4.160.0130.14018.85
5.4.150.0030.15319.14
5.4.140.0030.15716.55
5.4.130.0130.12016.46
5.4.120.0070.15716.45
5.4.110.0400.08316.48
5.4.100.0100.08716.38
5.4.90.0030.15716.35
5.4.80.0030.13016.44
5.4.70.0030.14716.47
5.4.60.0070.14716.51
5.4.50.0070.13316.31
5.4.40.0070.15016.64
5.4.30.0130.14016.32
5.4.20.0070.12716.50
5.4.10.0130.14016.44
5.4.00.0070.09315.95
5.3.290.0030.12014.73
5.3.280.0030.12714.64
5.3.270.0030.18314.61
5.3.260.0100.18314.62
5.3.250.0100.17314.77
5.3.240.0170.16314.64
5.3.230.0130.18314.75
5.3.220.0070.15014.64
5.3.210.0070.18014.50
5.3.200.0070.17014.57
5.3.190.0030.14714.58
5.3.180.0100.17314.58
5.3.170.0100.16714.62
5.3.160.0070.17014.62
5.3.150.0100.17014.56
5.3.140.0070.18714.48
5.3.130.0030.16314.61
5.3.120.0070.18314.58
5.3.110.0130.12314.57
5.3.100.0130.17014.05
5.3.90.0000.15714.05
5.3.80.0000.14713.97
5.3.70.0100.13714.04
5.3.60.0070.16014.03
5.3.50.0070.12314.03
5.3.40.0100.18713.98
5.3.30.0000.12313.98
5.3.20.0070.17013.73
5.3.10.0100.17013.82
5.3.00.0030.13713.54
5.2.170.0030.06711.12
5.2.160.0070.06311.17
5.2.150.0030.04011.23
5.2.140.0030.05011.18
5.2.130.0030.05011.27
5.2.120.0030.06011.14
5.2.110.0030.06310.99
5.2.100.0130.05711.29
5.2.90.0030.06011.16
5.2.80.0000.04311.26
5.2.70.0030.06311.04
5.2.60.0030.05711.06
5.2.50.0070.05011.08
5.2.40.0100.06010.92
5.2.30.0000.06710.92
5.2.20.0030.05011.02
5.2.10.0070.05310.79
5.2.00.0070.05010.73
5.1.60.0100.05010.00
5.1.50.0130.04710.04
5.1.40.0070.03310.14
5.1.30.0000.06010.50
5.1.20.0030.05710.36
5.1.10.0070.04710.07
5.1.00.0030.03710.07
5.0.50.0000.0238.51
5.0.40.0100.0378.41
5.0.30.0030.0438.30
5.0.20.0030.0438.12
5.0.10.0070.0408.33
5.0.00.0030.0578.12
4.4.90.0000.0337.88
4.4.80.0000.0207.88
4.4.70.0030.0277.88
4.4.60.0070.0237.88
4.4.50.0030.0177.88
4.4.40.0070.0337.88
4.4.30.0100.0277.88
4.4.20.0100.0177.88
4.4.10.0030.0177.88
4.4.00.0000.0277.88
4.3.110.0000.0307.88
4.3.100.0000.0237.88
4.3.90.0000.0277.88
4.3.80.0070.0337.88
4.3.70.0030.0207.88
4.3.60.0070.0177.88
4.3.50.0000.0377.88
4.3.40.0030.0537.88
4.3.30.0030.0337.88
4.3.20.0030.0277.88
4.3.10.0030.0337.88
4.3.00.0000.0277.88

preferences:
36.46 ms | 400 KiB | 5 Q