3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $x; public $y; public function __construct($x, $y) { $this->x = $x; $this->y = $y; } } $a = new A(1, "42"); print var_dump(new ArrayObject($a)); print "obj\n"; foreach ($a as $v) { $a->y = "500"; print $v . "\n"; } print "arr\n"; $b = array(1, 2, 3); foreach($b as $v) { $b[1] = 500; print $v . "\n"; } print "arr_iter\n"; $c = array(1, 2, 3); $i = new ArrayIterator($c); $i->rewind(); while ($i->valid()) { $c[1] = 500; print $i->current() . "\n"; $i->next(); }

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)
8.3.70.0090.00618.55
8.3.60.0070.00718.43
8.3.50.0110.01116.44
8.3.40.0120.00318.84
8.3.30.0110.00318.84
8.3.20.0070.00020.16
8.3.10.0090.00021.90
8.3.00.0080.00019.38
8.2.180.0140.00718.52
8.2.170.0070.00722.96
8.2.160.0060.00922.25
8.2.150.0070.00024.18
8.2.140.0050.00324.66
8.2.130.0040.00421.00
8.2.120.0080.00026.35
8.2.110.0070.00322.32
8.2.100.0080.00417.91
8.2.90.0030.00617.91
8.2.80.0000.00819.35
8.2.70.0040.00417.93
8.2.60.0000.00818.04
8.2.50.0040.00418.16
8.2.40.0070.00320.36
8.2.30.0000.00719.42
8.2.20.0000.00718.11
8.2.10.0040.00418.05
8.2.00.0070.00018.40
8.1.280.0100.01025.92
8.1.270.0040.00420.00
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0090.00022.01
8.1.230.0040.00720.92
8.1.220.0000.00817.77
8.1.210.0030.00618.77
8.1.200.0030.00617.35
8.1.190.0050.00317.35
8.1.180.0000.00818.10
8.1.170.0030.00618.48
8.1.160.0050.00318.79
8.1.150.0000.00720.17
8.1.140.0050.00519.07
8.1.130.0000.00719.06
8.1.120.0070.00017.41
8.1.110.0030.00617.43
8.1.100.0000.00717.50
8.1.90.0040.00417.45
8.1.80.0070.00017.43
8.1.70.0000.00917.48
8.1.60.0000.00817.54
8.1.50.0080.00017.53
8.1.40.0030.00617.46
8.1.30.0000.00817.69
8.1.20.0080.00017.63
8.1.10.0000.00717.46
8.1.00.0050.00217.48
8.0.300.0040.00420.09
8.0.290.0070.00016.75
8.0.280.0000.00718.35
8.0.270.0030.00317.24
8.0.260.0030.00317.25
8.0.250.0030.00316.80
8.0.240.0050.00316.94
8.0.230.0000.00917.01
8.0.220.0020.00516.77
8.0.210.0050.00216.77
8.0.200.0000.00616.94
8.0.190.0040.00417.00
8.0.180.0070.00016.91
8.0.170.0040.00916.88
8.0.160.0000.00816.84
8.0.150.0000.00716.79
8.0.140.0000.00716.89
8.0.130.0000.00513.33
8.0.120.0000.00816.84
8.0.110.0040.00416.84
8.0.100.0000.00816.75
8.0.90.0040.00416.71
8.0.80.0120.00316.89
8.0.70.0030.00516.68
8.0.60.0070.00016.87
8.0.50.0000.00716.91
8.0.30.0110.01017.18
8.0.20.0120.00817.40
8.0.10.0030.00517.07
8.0.00.0110.00816.82
7.4.330.0000.00515.55
7.4.320.0030.00316.36
7.4.300.0060.00016.35
7.4.290.0030.00316.60
7.4.280.0070.00016.48
7.4.270.0030.00316.61
7.4.260.0000.00716.53
7.4.250.0000.00716.58
7.4.240.0070.00016.43
7.4.230.0000.00816.66
7.4.220.0020.00516.67
7.4.210.0060.00916.48
7.4.200.0030.00316.61
7.4.160.0120.00916.58
7.4.150.0140.00417.40
7.4.140.0100.00817.86
7.4.130.0070.01016.63
7.4.120.0100.01116.58
7.4.110.0100.00716.56
7.4.100.0110.00716.64
7.4.90.0070.01016.49
7.4.80.0130.01319.39
7.4.70.0110.01116.48
7.4.60.0080.00816.49
7.4.50.0030.01016.55
7.4.40.0100.00716.41
7.4.00.0000.01315.04
7.3.330.0030.00313.37
7.3.320.0000.00513.43
7.3.310.0000.00716.25
7.3.300.0040.00416.37
7.3.290.0050.01016.33
7.3.280.0090.00816.31
7.3.270.0100.00717.40
7.3.260.0120.00616.36
7.3.250.0130.00416.56
7.3.240.0090.01216.38
7.3.230.0060.01216.59
7.3.210.0170.00016.18
7.3.200.0060.00916.41
7.3.190.0160.00016.28
7.3.180.0060.00916.55
7.3.170.0130.00316.48
7.3.160.0000.01616.40
7.2.330.0170.00016.71
7.2.320.0060.01816.77
7.2.310.0030.01416.86
7.2.300.0120.00916.74
7.2.290.0060.01016.76
7.2.110.0030.01016.52
7.2.60.0120.00016.97
7.2.10.0450.00617.63
7.2.00.0290.01317.78
7.1.200.0030.01215.68
7.1.130.0300.01116.66
7.1.120.0440.01416.70
7.1.110.0390.00716.16
7.1.100.0310.01016.27
7.1.90.0480.01416.00
7.1.80.0490.01016.13
7.1.70.0580.01015.40
7.1.60.0480.00933.41
7.1.50.0490.01032.71
7.1.40.1070.00632.67
7.1.30.0550.01732.81
7.1.20.0440.01332.61
7.1.10.0310.01514.85
7.1.00.0410.01014.83

preferences:
59.12 ms | 401 KiB | 5 Q