3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = [1,2,3]; foreach($x as &$ref){ $ref += 100; } /* $x === [101, 102, 103] at this point, $ref is bound to the last element of $x, that's OK */ $b = $x; /* this should logically copy $x to $b *by value* (COW happens) */ $b[0] = 0; /* this should force an array copy in memory */ /* here, $ref should be rebound to the elements of $x by reference */ foreach($x as &$ref){ $ref += 100; } /* at this point, $x === [201, 202, 203] which is correct, $ref refers to the last element of $x again, which is OK, BUT! As we copied $b by value before, is should stay as is, but the last element of $b changes to 203! */ var_dump($b);

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.60.0180.00316.73
8.3.50.0090.00921.99
8.3.40.0110.00718.49
8.3.30.0110.00718.60
8.3.20.0080.00019.16
8.3.10.0070.00021.91
8.3.00.0040.00419.20
8.2.180.0070.01418.16
8.2.170.0110.00422.96
8.2.160.0070.00722.13
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0100.00317.93
8.2.120.0030.00526.35
8.2.110.0050.00521.11
8.2.100.0120.00017.93
8.2.90.0040.00419.17
8.2.80.0000.00817.97
8.2.70.0000.00917.50
8.2.60.0080.00017.90
8.2.50.0080.00018.09
8.2.40.0060.00322.32
8.2.30.0000.00819.56
8.2.20.0050.00317.71
8.2.10.0040.00418.17
8.2.00.0050.00318.03
8.1.280.0130.00625.92
8.1.270.0080.00023.97
8.1.260.0040.00428.09
8.1.250.0080.00028.09
8.1.240.0090.00022.57
8.1.230.0070.00419.04
8.1.220.0050.00317.80
8.1.210.0000.00818.77
8.1.200.0100.00017.38
8.1.190.0000.00817.25
8.1.180.0030.00518.10
8.1.170.0040.00418.52
8.1.160.0040.00420.70
8.1.150.0040.00420.70
8.1.140.0070.00019.48
8.1.130.0070.00417.75
8.1.120.0040.00417.40
8.1.110.0030.00417.48
8.1.100.0040.00417.45
8.1.90.0040.00417.46
8.1.80.0000.00717.46
8.1.70.0020.00517.34
8.1.60.0040.00417.54
8.1.50.0000.00917.52
8.1.40.0080.00017.54
8.1.30.0040.00417.49
8.1.20.0030.00517.62
8.1.10.0040.00417.47
8.1.00.0070.00017.33
8.0.300.0080.00018.77
8.0.290.0070.00016.63
8.0.280.0040.00318.45
8.0.270.0000.00717.26
8.0.260.0070.00017.21
8.0.250.0050.00216.96
8.0.240.0040.00416.81
8.0.230.0000.00816.96
8.0.220.0040.00416.94
8.0.210.0070.00016.88
8.0.200.0000.00616.98
8.0.190.0060.00316.95
8.0.180.0040.00416.84
8.0.170.0000.00816.93
8.0.160.0070.00016.80
8.0.150.0060.00316.96
8.0.140.0040.00416.86
8.0.130.0000.00613.32
8.0.120.0040.00416.86
8.0.110.0080.00016.76
8.0.100.0000.00716.77
8.0.90.0000.00716.76
8.0.80.0130.00916.84
8.0.70.0050.00316.68
8.0.60.0040.00416.85
8.0.50.0050.00216.75
8.0.30.0090.00917.17
8.0.20.0060.01517.41
8.0.10.0000.00716.88
8.0.00.0130.01016.63
7.4.330.0000.00415.08
7.4.320.0030.00316.52
7.4.300.0030.00316.64
7.4.290.0000.00616.61
7.4.280.0060.00316.62
7.4.270.0040.00416.55
7.4.260.0000.00716.50
7.4.250.0070.00016.36
7.4.240.0030.00416.44
7.4.230.0000.00716.30
7.4.220.0080.00816.63
7.4.210.0080.00616.57
7.4.200.0000.00716.60
7.4.160.0100.00716.44
7.4.150.0030.01417.40
7.4.140.0070.01217.86
7.4.130.0080.00916.48
7.4.120.0100.00716.56
7.4.110.0070.01016.32
7.4.100.0080.00816.36
7.4.90.0140.00316.53
7.4.80.0100.00719.39
7.4.70.0110.00516.44
7.4.60.0140.00416.50
7.4.50.0050.00516.73
7.4.40.0140.00316.69
7.4.30.0030.01316.48
7.4.00.0030.00914.98
7.3.330.0050.00013.22
7.3.320.0050.00013.18
7.3.310.0030.00616.33
7.3.300.0000.00616.22
7.3.290.0000.00716.32
7.3.280.0100.00716.27
7.3.270.0120.01117.40
7.3.260.0110.00716.32
7.3.250.0130.00916.46
7.3.240.0100.00716.34
7.3.230.0150.00916.39
7.3.210.0160.00016.47
7.3.200.0120.00919.39
7.3.190.0120.00616.38
7.3.180.0060.01216.31
7.3.170.0120.00916.40
7.3.160.0040.01216.21
7.3.10.0040.00816.72
7.3.00.0060.00616.41
7.2.330.0090.00916.63
7.2.320.0130.00716.44
7.2.310.0070.01016.66
7.2.300.0070.01716.57
7.2.290.0100.00716.50
7.2.130.0080.00417.07
7.2.120.0090.00516.95
7.2.110.0100.00316.93
7.2.100.0080.00616.76
7.2.90.0100.00316.95
7.2.80.0020.01216.87
7.2.70.0030.01016.87
7.2.60.0050.00916.94
7.2.50.0050.00916.97
7.2.40.0060.00916.75
7.2.30.0080.00416.82
7.2.20.0080.00716.88
7.2.10.0100.00316.72
7.2.00.0030.01116.79
7.1.250.0060.00515.87
7.1.240.0090.00615.68
7.1.230.0030.01015.88
7.1.220.0070.01015.54
7.1.210.0000.01115.87
7.1.200.0050.00715.79
7.1.190.0090.00615.95
7.1.180.0040.01115.82
7.1.170.0000.01015.80
7.1.160.0100.00615.75
7.1.150.0000.01115.74
7.1.140.0030.00615.61
7.1.130.0100.00315.86
7.1.120.0100.00316.00
7.1.110.0000.01315.91
7.1.100.0100.00315.84
7.1.90.0070.00715.67
7.1.80.0030.01315.95
7.1.70.0050.00316.36
7.1.60.0080.01117.89
7.1.50.0110.00315.87
7.1.40.0070.00715.82
7.1.30.0040.00415.53
7.1.20.0040.01115.53
7.1.10.0090.00315.80
7.1.00.0020.04119.17
7.0.330.0090.00615.47
7.0.320.0000.00915.21
7.0.310.0070.00715.40
7.0.300.0040.00815.38
7.0.290.0120.00315.29
7.0.280.0090.00315.23
7.0.270.0070.00715.44
7.0.260.0060.00615.12
7.0.250.0030.01015.27
7.0.240.0000.00815.54
7.0.230.0000.01315.50
7.0.220.0030.00815.45
7.0.210.0030.00615.48
7.0.200.0170.00215.00
7.0.190.0040.00915.25
7.0.180.0060.00315.40
7.0.170.0000.01315.62
7.0.160.0090.00615.41
7.0.150.0030.00615.49
7.0.140.0030.01215.44
7.0.130.0000.00815.48
7.0.120.0000.01415.45
7.0.110.0060.00615.46
7.0.100.0000.00915.46
7.0.90.0060.00615.41
7.0.80.0040.00415.16
7.0.70.0040.00715.39
7.0.60.0100.02917.59
7.0.50.0250.03317.96
7.0.40.0050.03616.94
7.0.30.0110.03316.84
7.0.20.0150.02817.01
7.0.10.0140.03016.92
7.0.00.0170.02716.91
5.6.380.0040.01114.43
5.6.370.0110.00414.41
5.6.360.0060.00614.32
5.6.350.0070.00414.42
5.6.340.0050.00514.68
5.6.330.0040.00714.68
5.6.320.0000.00814.74
5.6.310.0060.01014.42
5.6.300.0070.00714.71
5.6.290.0040.01114.23
5.6.280.0060.03917.91
5.6.270.0060.01014.14
5.6.260.0000.01414.11
5.6.250.0070.00714.49
5.6.240.0030.00614.43
5.6.230.0090.00314.45
5.6.220.0080.00014.54
5.6.210.0020.03817.38
5.6.200.0310.02617.68
5.6.190.0150.03017.85
5.6.180.0120.03217.86
5.6.170.0110.02617.72
5.6.160.0140.02917.66
5.6.150.0080.03617.67
5.6.140.0170.02517.75
5.6.130.0100.03017.72
5.6.120.0120.03217.74
5.6.110.0100.03517.71
5.6.100.0130.03217.59
5.6.90.0080.03517.74
5.6.80.0150.02717.43
5.6.70.0120.03017.43
5.6.60.0190.03217.46
5.6.50.0120.04017.24
5.6.40.0090.02817.33
5.6.30.0100.03017.48
5.6.20.0130.03217.18
5.6.10.0100.03117.42
5.6.00.0120.02817.29
5.5.380.0100.00011.07
5.5.370.0030.01011.01
5.5.360.0060.00611.02
5.5.350.0150.03315.77
5.5.340.0260.02815.92
5.5.330.0070.03215.92
5.5.320.0080.03316.02
5.5.310.0130.02816.02
5.5.300.0120.02915.97
5.5.290.0120.03216.02
5.5.280.0150.02516.12
5.5.270.0080.03115.97
5.5.260.0130.02816.10
5.5.250.0130.02915.91
5.5.240.0130.02815.49
5.5.230.0130.03515.65
5.5.220.0130.03815.61
5.5.210.0150.03315.53
5.5.200.0150.03715.65
5.5.190.0100.04215.66
5.5.180.0150.03515.60
5.5.170.0060.00610.94
5.5.160.0080.04015.66
5.5.150.0110.03315.68
5.5.140.0090.02815.70
5.5.130.0130.02715.52
5.5.120.0070.03415.59
5.5.110.0100.02915.43
5.5.100.0140.02315.65
5.5.90.0080.03015.59
5.5.80.0090.03215.46
5.5.70.0100.04015.69
5.5.60.0020.04215.46
5.5.50.0120.02815.60
5.5.40.0100.03015.67
5.5.30.0070.02815.63
5.5.20.0050.03415.58
5.5.10.0080.03015.69
5.5.00.0050.03215.55

preferences:
59.21 ms | 401 KiB | 5 Q