3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { protected $bar; public function init($callable) { $callable($this, $this->bar); } public function setBar($bar) { $this->bar = $bar; } } $a = new A(); $callable1 = function($obj, &$bar) { $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.4.10.0070.05214.95
7.4.00.0100.03614.84
7.3.130.0060.05514.39
7.3.120.0000.05115.00
7.3.110.0030.04614.75
7.3.100.0100.03515.05
7.3.90.0100.03515.04
7.3.80.0060.03514.86
7.3.70.0030.03414.89
7.3.60.0070.04614.87
7.3.50.0030.03714.85
7.3.40.0070.03614.88
7.3.30.0100.03414.84
7.3.20.0100.03516.70
7.3.10.0070.05016.53
7.3.00.0070.03616.84
7.2.260.0100.03915.24
7.2.250.0030.06015.34
7.2.240.0100.04214.86
7.2.230.0070.05714.80
7.2.220.0100.03815.01
7.2.210.0000.04914.95
7.2.200.0030.04115.04
7.2.190.0030.04615.11
7.2.180.0030.04315.02
7.2.170.0100.03815.04
7.2.160.0070.04115.08
7.2.150.0000.04616.95
7.2.140.0070.04516.97
7.2.130.0000.05016.97
7.2.120.0000.04817.02
7.2.110.0070.03716.92
7.2.100.0030.04816.77
7.2.90.0070.03917.06
7.2.80.0070.04416.83
7.2.70.0070.04416.74
7.2.60.0030.04716.77
7.2.50.0030.04217.08
7.2.40.0090.03816.80
7.2.30.0060.05816.98
7.2.20.0030.04416.68
7.2.10.0070.05016.91
7.2.00.0070.04316.81
7.1.330.0130.05015.65
7.1.320.0070.06316.11
7.1.310.0070.05915.94
7.1.300.0060.04815.80
7.1.290.0070.05615.64
7.1.280.0030.05615.86
7.1.270.0030.05415.84
7.1.260.0030.05915.87
7.1.250.0060.05215.79
7.1.240.0000.06515.53
7.1.230.0060.05115.66
7.1.220.0070.05515.53
7.1.210.0000.05815.89
7.1.200.0070.04615.88
7.1.190.0030.05615.76
7.1.180.0060.04815.56
7.1.170.0030.05215.91
7.1.160.0030.05416.01
7.1.150.0070.05415.75
7.1.140.0070.04915.95
7.1.130.0030.05515.87
7.1.120.0030.05515.54
7.1.110.0070.04915.61
7.1.100.0030.05615.66
7.1.90.0040.04915.80
7.1.80.0070.04615.55
7.1.70.0030.04316.38
7.1.60.0070.05417.68
7.1.50.0020.06116.28
7.1.40.0100.05315.79
7.1.30.0070.05615.90
7.1.20.0030.05615.84
7.1.10.0000.05815.69
7.1.00.0030.08318.99
7.0.330.0030.05615.38
7.0.320.0000.05715.32
7.0.310.0030.05315.34
7.0.300.0070.05015.39
7.0.290.0030.05015.28
7.0.280.0030.05515.44
7.0.270.0070.05515.35
7.0.260.0000.06415.54
7.0.250.0000.06215.39
7.0.240.0070.05315.48
7.0.230.0000.05515.34
7.0.220.0100.04815.25
7.0.210.0000.05615.59
7.0.200.0020.04316.04
7.0.190.0030.06215.25
7.0.180.0030.05515.51
7.0.170.0100.04515.39
7.0.160.0030.05615.46
7.0.150.0030.05315.43
7.0.140.0030.07818.88
7.0.130.0070.05315.52
7.0.120.0000.05818.84
7.0.110.0030.05315.35
7.0.100.0030.06215.52
7.0.90.0100.06915.09
7.0.80.0070.05815.54
7.0.70.0030.05215.29
7.0.60.0100.08317.81
7.0.50.0050.06116.74
7.0.40.0050.06016.86
7.0.30.0130.06416.86
7.0.20.0020.06216.85
7.0.10.0070.06016.90
7.0.00.0020.06416.67
5.6.400.0070.13414.59
5.6.390.0030.11614.24
5.6.380.0030.13214.76
5.6.370.0000.12114.45
5.6.360.0030.13114.64
5.6.350.0100.12914.28
5.6.340.0000.13114.90
5.6.330.0000.12314.37
5.6.320.0030.12114.48
5.6.310.0030.14514.58
5.6.300.0000.13314.34
5.6.290.0000.15114.34
5.6.280.0050.14017.58
5.6.270.0100.11314.41
5.6.260.0030.12914.71
5.6.250.0070.12214.45
5.6.240.0070.12114.25
5.6.230.0000.12814.23
5.6.220.0130.11314.26
5.6.210.0050.14617.56
5.6.200.0020.13316.26
5.6.190.0070.14317.45
5.6.180.0220.13217.46
5.6.170.0150.13817.49
5.6.160.0050.13917.55
5.6.150.0080.13216.32
5.6.140.0030.14216.33
5.6.130.0070.16316.18
5.6.120.0070.13917.63
5.6.110.0070.13617.78
5.6.100.0110.13017.64
5.6.90.0100.12317.61
5.6.80.0080.10517.28
5.6.70.1650.12117.21
5.6.60.0070.11914.61
5.6.50.0030.12714.39
5.6.40.0030.11914.48
5.6.30.0100.13214.44
5.6.20.0000.13714.22
5.6.10.0000.11914.55
5.6.00.0000.12014.73
5.5.380.0070.13914.48
5.5.370.0030.11514.36
5.5.360.0070.12614.25
5.5.350.0150.12317.44
5.5.340.0030.13416.29
5.5.330.0120.13617.37
5.5.320.0280.11817.23
5.5.310.0120.11817.20
5.5.300.0080.10616.29
5.5.290.0100.15316.29
5.5.280.0070.13517.56
5.5.270.0100.13917.56
5.5.260.0230.13117.69
5.5.250.0080.14117.58
5.5.240.2150.10517.37
5.5.230.0070.12214.44
5.5.220.0030.12214.41
5.5.210.0070.12014.48
5.5.200.0030.11314.12
5.5.190.0000.12514.44
5.5.180.0030.11514.50
5.5.170.0070.11414.31
5.5.160.0100.10814.32
5.5.150.0070.12114.71
5.5.140.0070.10814.23
5.5.130.0030.12114.33
5.5.120.0100.10714.54
5.5.110.0030.11614.25
5.5.100.0000.12314.16
5.5.90.0030.11514.10
5.5.80.0000.11614.46
5.5.70.0030.12814.29
5.5.60.0000.11614.48
5.5.50.0070.11614.51
5.5.40.0100.10914.33
5.5.30.0100.10714.48
5.5.20.0030.11914.20
5.5.10.0030.11214.02
5.5.00.0000.11914.50
5.4.450.0080.14015.40
5.4.440.0050.13715.38
5.4.430.0050.10715.15
5.4.420.0030.13215.48
5.4.410.0020.12915.18
5.4.400.0070.12815.15
5.4.390.0080.14315.30
5.4.380.0050.13515.20
5.4.370.0030.11415.20
5.4.360.0100.14515.29
5.4.350.0050.10414.96
5.4.340.0100.13315.10
5.4.330.0000.12511.20
5.4.320.0020.12515.29
5.4.310.0120.13115.00
5.4.300.0080.11015.08
5.4.290.0070.10614.88
5.4.280.0030.13515.24
5.4.270.0070.12915.07
5.4.260.0050.13214.99
5.4.250.0050.13115.10
5.4.240.0070.12815.15
5.4.230.0070.11315.12
5.4.220.0020.10715.10
5.4.210.0100.12315.13
5.4.200.0020.12315.12
5.4.190.0050.13914.80
5.4.180.0020.10415.06
5.4.170.0030.12814.96
5.4.160.0050.13214.93
5.4.150.0050.15714.91
5.4.140.0050.13813.76
5.4.130.0050.10813.90
5.4.120.0070.13413.83
5.4.110.0020.11113.96
5.4.100.0070.10613.85
5.4.90.0070.12713.91
5.4.80.0050.14313.87
5.4.70.0000.11413.70
5.4.60.0070.10213.64
5.4.50.0030.10613.67
5.4.40.0030.11113.63
5.4.30.0050.10713.81
5.4.20.0050.11813.96
5.4.10.0030.11313.73
5.4.00.0050.11413.48
5.3.290.0020.19712.76
5.3.280.0050.16312.60
5.3.270.0030.17012.56
5.3.260.0070.17412.46
5.3.250.0070.16712.71
5.3.240.0030.17012.50
5.3.230.0000.15712.62
5.3.220.0020.17212.57
5.3.210.0020.14212.55
5.3.200.0050.17112.60
5.3.190.0120.19512.59
5.3.180.0020.15312.63
5.3.170.0000.15212.73
5.3.160.0020.14112.59
5.3.150.0030.16012.48
5.3.140.0050.14212.59
5.3.130.0050.14012.55
5.3.120.0030.15212.62
5.3.110.0020.16412.58
5.3.100.0030.14112.35
5.3.90.0020.14412.27
5.3.80.0070.19312.30
5.3.70.0030.18112.26
5.3.60.0030.17012.27
5.3.50.0020.14612.32
5.3.40.0050.16112.36
5.3.30.0050.15112.28
5.3.20.0020.16012.11
5.3.10.0030.14912.04
5.3.00.0070.15211.99
5.2.170.0030.02711.11
5.2.160.0030.02711.11
5.2.150.0000.03011.19
5.2.140.0000.03311.30
5.2.130.0000.03011.12
5.2.120.0030.02711.05
5.2.110.0030.02711.11
5.2.100.0000.03011.11
5.2.90.0070.02311.05
5.2.80.0000.03711.07
5.2.70.0030.02711.19
5.2.60.0030.02711.05
5.2.50.0000.03011.05
5.2.40.0000.03011.04
5.2.30.0000.03011.00
5.2.20.0030.02711.11
5.2.10.0100.02010.75
5.2.00.0000.03310.75
5.1.60.0070.0239.91
5.1.50.0000.0279.97
5.1.40.0000.0279.96
5.1.30.0030.04010.34
5.1.20.0000.06010.37
5.1.10.0030.0279.98
5.1.00.0070.05310.04
5.0.50.0000.0478.52
5.0.40.0070.0438.39
5.0.30.0000.0378.37
5.0.20.0100.0308.24
5.0.10.0100.0338.08
5.0.00.0000.0708.07
4.4.90.0000.0177.90
4.4.80.0030.0137.90
4.4.70.0000.0177.90
4.4.60.0070.0177.90
4.4.50.0000.0237.90
4.4.40.0000.0237.90
4.4.30.0070.0107.90
4.4.20.0000.0207.90
4.4.10.0070.0337.90
4.4.00.0070.0507.90
4.3.110.0000.0237.90
4.3.100.0070.0307.90
4.3.90.0030.0337.90
4.3.80.0030.0237.90
4.3.70.0000.0207.90
4.3.60.0070.0307.90
4.3.50.0070.0177.90
4.3.40.0000.0577.90
4.3.30.0070.0307.90
4.3.20.0000.0407.90
4.3.10.0030.0177.90
4.3.00.0000.0207.90

preferences:
47.4 ms | 401 KiB | 5 Q