3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = array(1, 2, 3, 4, 5); foreach($a as $n) { echo "$n"; if ($n == 4) { $a = array_merge($a, array(6, 7)); } } $a = array(1, 2, 3, 4, 5); foreach($a as $n) { echo "$n"; if ($n == 4) { $a[] = 6; $a[] = 7; } } $a = array(1, 2, 3, 4, 5); foreach($a as $n) { echo "$n"; if ($n == 4) { array_push($a, 6); array_push($a, 7); } } $a = array(1, 2, 3, 4, 5); foreach($a as $n) { echo "$n"; if ($n == 4) { array_push($a, 6, 7); } } $a = array(1, 2, 3, 4, 5); foreach($a as $n) { echo "$n"; if ($n == 4) { array_push($a, array(6, 7)); } }
based on 87AV3

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).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
7.3.10.0110.00316.54
7.3.00.0080.00416.83
7.2.130.0050.00516.86
7.2.120.0000.00816.91
7.2.110.0030.00717.04
7.2.100.0120.00316.86
7.2.90.0040.00716.88
7.2.80.0000.01116.91
7.2.70.0000.01116.84
7.2.60.0050.00916.96
7.2.50.0030.00617.02
7.2.40.0110.00316.84
7.2.30.0060.00616.92
7.2.20.0000.00817.13
7.2.10.0080.00816.63
7.2.00.0140.00717.94
7.1.250.0030.01015.79
7.1.200.0100.00315.64
7.1.100.0110.00418.07
7.1.70.0000.01016.90
7.1.60.0070.01719.46
7.1.50.0250.01434.89
7.1.00.0000.08022.54
7.0.200.0040.00416.79
7.0.140.0000.03722.07
7.0.110.0070.06319.98
7.0.100.0070.05719.93
7.0.90.0500.03719.93
7.0.80.0200.04320.11
7.0.70.0400.03720.07
7.0.60.0400.04019.99
7.0.50.0070.05020.08
7.0.40.0030.04319.82
7.0.30.0030.06019.66
7.0.20.0100.03019.73
7.0.10.0000.04719.72
7.0.00.0030.04019.66
5.6.280.0030.07721.13
5.6.260.0030.08020.68
5.6.250.0070.05720.68
5.6.240.0130.03020.55
5.6.230.0070.06720.65
5.6.220.0130.02720.46
5.6.210.0000.04720.59
5.6.200.0030.04320.57
5.6.190.0030.04020.56
5.6.180.0070.03320.57
5.6.170.0070.03720.67
5.6.160.0030.03720.60
5.6.150.0030.03720.63
5.6.140.0070.03720.70
5.6.130.0070.08720.61
5.6.120.0100.05720.57
5.6.110.0100.06720.54
5.6.100.0030.03320.60
5.6.90.0030.04020.60
5.6.80.0130.07319.89
5.6.70.0130.04020.23
5.6.60.0100.03720.07
5.6.50.0130.06019.94
5.6.40.0070.04020.22
5.6.30.0070.06719.83
5.6.20.0070.03720.05
5.6.10.0100.07320.01
5.6.00.0070.07020.00
5.5.380.0030.04317.67
5.5.370.0130.07017.41
5.5.360.0000.04717.39
5.5.350.0000.04317.55
5.5.340.0030.04018.13
5.5.330.0070.04018.13
5.5.320.0030.03317.99
5.5.310.0070.04017.77
5.5.300.0070.08717.84
5.5.290.0100.04718.10
5.5.280.0000.07718.15
5.5.270.0100.03017.82
5.5.260.0100.05717.84
5.5.250.0100.06717.82
5.5.240.0130.07317.48
5.5.230.0100.07017.40
5.5.220.0130.06717.19
5.5.210.0070.04017.47
5.5.200.0100.08317.48
5.5.190.0030.04017.11
5.5.180.0070.04017.47
5.5.160.0070.04017.51
5.5.150.0070.08017.24
5.5.140.0030.05317.19
5.5.130.0070.04317.33
5.5.120.0000.07017.38
5.5.110.0000.04317.37
5.5.100.0070.07317.14
5.5.90.0030.06717.34
5.5.80.0030.03017.10
5.5.70.0130.05717.11
5.5.60.0070.05717.10
5.5.50.0100.03017.25
5.5.40.0130.05317.25
5.5.30.0030.07717.40
5.5.20.0200.02317.28
5.5.10.0070.07317.01
5.5.00.0030.07017.10
5.4.450.0030.03719.51
5.4.440.0070.05719.32
5.4.430.0100.07719.30
5.4.420.0030.03319.49
5.4.410.0030.06319.18
5.4.400.0100.03319.02
5.4.390.0100.06718.95
5.4.380.0070.05019.27
5.4.370.0030.08019.01
5.4.360.0130.07019.16
5.4.350.0100.07718.95
5.4.340.0030.04018.98
5.4.320.0070.06318.98
5.4.310.0000.07019.25
5.4.300.0100.03018.92
5.4.290.0170.06319.07
5.4.280.0070.05019.00
5.4.270.0030.03718.98
5.4.260.0100.07019.10
5.4.250.0070.03019.11
5.4.240.0030.05019.27
5.4.230.0000.05719.07
5.4.220.0000.08019.09
5.4.210.0070.04319.12
5.4.200.0030.03018.94
5.4.190.0070.04319.11
5.4.180.0000.06318.99
5.4.170.0100.06718.91
5.4.160.0000.03718.98
5.4.150.0070.07718.93
5.4.140.0000.03316.54
5.4.130.0070.04316.52
5.4.120.0000.06316.21
5.4.110.0130.06716.18
5.4.100.0000.03716.52
5.4.90.0000.03716.23
5.4.80.0100.03316.22
5.4.70.0070.05716.28
5.4.60.0030.04016.35
5.4.50.0030.03716.46
5.4.40.0030.04016.52
5.4.30.0000.03716.25
5.4.20.0070.03316.37
5.4.10.0030.03016.49
5.4.00.0000.04315.61
5.3.290.0030.07014.68
5.3.280.0070.07714.71
5.3.270.0070.03714.41
5.3.260.0030.03314.70
5.3.250.0030.06314.64
5.3.240.0100.03014.68
5.3.230.0030.04314.68
5.3.220.0100.04014.65
5.3.210.0100.06314.53
5.3.200.0100.07314.59
5.3.190.0100.03014.64
5.3.180.0100.02314.64
5.3.170.0100.03714.37
5.3.160.0100.05314.45
5.3.150.0030.05714.52
5.3.140.0030.03714.49
5.3.130.0030.03714.35
5.3.120.0030.04014.56
5.3.110.0100.08714.57
5.3.100.0100.05713.90
5.3.90.0030.07313.82
5.3.80.0100.03014.04
5.3.70.0000.04013.86
5.3.60.0000.03713.90
5.3.50.0030.05013.79
5.3.40.0070.05713.89
5.3.30.0030.03314.00
5.3.20.0070.02713.64
5.3.10.0000.04313.55
5.3.00.0030.05013.50
5.2.170.0100.06311.93
5.2.160.0030.04311.93
5.2.150.0100.06011.93
5.2.140.0030.05011.93
5.2.130.0070.05711.93
5.2.120.0030.05011.93
5.2.110.0030.06311.93
5.2.100.0030.02311.93
5.2.90.0070.02011.93
5.2.80.0030.06311.93
5.2.70.0070.05711.93
5.2.60.0070.02711.93
5.2.50.0130.04711.93
5.2.40.0030.06311.93
5.2.30.0000.02711.93
5.2.20.0070.05011.93
5.2.10.0030.04011.93
5.2.00.0070.05011.93
5.1.60.0000.03311.93
5.1.50.0070.02311.93
5.1.40.0070.03011.93
5.1.30.0030.05711.93
5.1.20.0000.05011.93
5.1.10.0030.05711.93
5.1.00.0000.04311.93
5.0.50.0030.03311.93
5.0.40.0030.04311.93
5.0.30.0070.05011.93
5.0.20.0030.02711.93
5.0.10.0030.04711.93
5.0.00.0000.06711.93
4.4.90.0000.02311.93
4.4.80.0000.03711.93
4.4.70.0000.01711.93
4.4.60.0000.01311.93
4.4.50.0030.02011.93
4.4.40.0000.05011.93
4.4.30.0000.03011.93
4.4.20.0070.01311.93
4.4.10.0030.02311.93
4.4.00.0100.03311.93
4.3.110.0100.01311.93
4.3.100.0000.03011.93
4.3.90.0000.02311.93
4.3.80.0030.03711.93
4.3.70.0000.02011.93
4.3.60.0030.03011.93
4.3.50.0100.01711.93
4.3.40.0000.03311.93
4.3.30.0000.03011.93
4.3.20.0030.01311.93
4.3.10.0000.02311.93
4.3.00.0000.03711.93