3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* * PHP 5.6 Variadics allow us to pack arguments into arrays from the function prototype! * Typically you would use a combination of func_get_args and array_slice to grab these * function arguments from the stack frame, but Variadics make the syntax much nicer. */ // Pre PHP 5.6 you would do the following ... function bond($agent) { $bondingAgents = array_slice(func_get_args(), 1); $bonding = ""; foreach ($bondingAgents as $bond) { $bonding .= "$agent-$bond\n"; } return $bonding; } // With PHp 5.6 you cna do this instead ... function newBond($agent, ...$bondingAgents) { $bonding = ""; foreach($bondingAgents as $bond) { $bonding .= "$agent-$bond\n"; } return $bonding; } header('Content-type: text/plain'); echo "Pre-5.6 Result...\n\n"; echo bond("Hydrogen", "Oxide", "Peroxide", "Dioxide"); echo "5.6 Result...\n\n"; echo newBond("Hydrogen", "Oxide", "Peroxide", "Dioxide");

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.0100.01018.55
8.3.50.0090.01322.11
8.3.40.0090.00918.74
8.3.30.0120.00619.04
8.3.20.0080.00820.34
8.3.10.0050.00322.14
8.3.00.0090.00922.21
8.2.180.0080.00816.75
8.2.170.0000.01422.96
8.2.160.0080.01119.21
8.2.150.0040.00424.18
8.2.140.0100.00024.66
8.2.130.0150.00426.16
8.2.120.0040.00419.66
8.2.110.0030.00621.91
8.2.100.0120.00318.09
8.2.90.0050.00319.10
8.2.80.0040.00418.05
8.2.70.0080.00017.63
8.2.60.0000.00817.93
8.2.50.0030.00618.07
8.2.40.0050.00318.16
8.2.30.0030.00518.02
8.2.20.0040.00417.72
8.2.10.0040.00417.81
8.2.00.0000.00917.82
8.1.280.0110.00725.92
8.1.270.0050.00318.58
8.1.260.0040.00426.35
8.1.250.0050.00228.09
8.1.240.0080.00023.79
8.1.230.0080.00319.01
8.1.220.0000.00817.79
8.1.210.0040.00418.77
8.1.200.0030.00617.23
8.1.190.0030.00617.52
8.1.180.0040.00420.58
8.1.170.0000.00818.54
8.1.160.0040.00422.15
8.1.150.0050.00318.63
8.1.140.0040.00417.50
8.1.130.0030.00317.88
8.1.120.0040.00417.53
8.1.110.0000.00717.46
8.1.100.0000.00717.51
8.1.90.0030.00617.41
8.1.80.0030.00317.45
8.1.70.0000.00717.43
8.1.60.0080.00017.46
8.1.50.0050.00317.49
8.1.40.0080.00017.59
8.1.30.0020.00517.68
8.1.20.0080.00017.61
8.1.10.0040.00417.50
8.1.00.0030.00617.53
8.0.300.0050.00218.77
8.0.290.0000.00717.18
8.0.280.0070.00018.41
8.0.270.0030.00317.25
8.0.260.0070.00016.82
8.0.250.0070.00016.86
8.0.240.0040.00416.95
8.0.230.0080.00016.89
8.0.220.0070.00016.95
8.0.210.0030.00316.92
8.0.200.0050.00216.80
8.0.190.0050.00216.83
8.0.180.0030.00416.94
8.0.170.0000.00716.94
8.0.160.0000.00816.87
8.0.150.0030.00516.92
8.0.140.0030.00316.76
8.0.130.0030.00313.34
8.0.120.0030.00616.75
8.0.110.0070.00016.87
8.0.100.0040.00416.79
8.0.90.0070.00016.95
8.0.80.0090.00616.94
8.0.70.0040.00416.70
8.0.60.0040.00416.70
8.0.50.0050.00216.88
8.0.30.0120.00617.24
8.0.20.0080.01317.40
8.0.10.0070.00017.13
8.0.00.0060.01216.75
7.4.330.0060.00015.13
7.4.320.0030.00316.63
7.4.300.0030.00316.65
7.4.290.0070.00016.61
7.4.280.0040.00416.52
7.4.270.0000.00616.50
7.4.260.0040.00416.43
7.4.250.0000.00716.45
7.4.240.0050.00216.62
7.4.230.0000.00716.39
7.4.220.0080.00816.63
7.4.210.0090.00616.61
7.4.200.0030.00316.68
7.4.190.0000.00716.78
7.4.160.0130.00916.61
7.4.150.0100.01017.40
7.4.140.0110.00917.86
7.4.130.0110.01116.55
7.4.120.0060.01016.65
7.4.110.0060.01116.52
7.4.100.0150.00316.55
7.4.90.0110.00716.69
7.4.80.0100.00719.39
7.4.70.0110.00716.50
7.4.60.0130.00616.60
7.4.50.0000.00516.39
7.4.40.0030.01322.77
7.4.30.0080.00816.38
7.4.00.0040.00714.71
7.3.330.0020.00213.33
7.3.320.0030.00313.39
7.3.310.0030.00316.27
7.3.300.0000.00716.32
7.3.290.0130.00316.35
7.3.280.0070.01016.38
7.3.270.0110.00617.40
7.3.260.0120.00916.63
7.3.250.0090.00816.48
7.3.240.0070.01016.40
7.3.230.0080.00816.39
7.3.210.0070.01016.28
7.3.200.0060.01019.39
7.3.190.0040.01316.54
7.3.180.0150.00616.38
7.3.170.0060.00916.38
7.3.160.0030.01716.66
7.3.120.0060.00614.97
7.2.330.0090.00916.78
7.2.320.0110.00516.87
7.2.310.0130.00916.38
7.2.300.0110.00616.65
7.2.290.0190.00316.76
7.2.60.0320.00616.63
7.1.200.0060.00915.65
7.1.70.0000.00717.02
7.1.60.0130.01319.82
7.1.50.0040.01817.07
7.1.00.0030.06322.50
7.0.200.0090.00914.63
7.0.140.0070.07322.18
7.0.60.0000.08320.04
7.0.50.0100.03317.86
7.0.40.0100.07020.04
7.0.30.0200.04020.24
7.0.20.0200.06720.30
7.0.10.0300.07720.05
7.0.00.0100.06320.16
5.6.280.0000.07721.14
5.6.210.0100.08320.47
5.6.200.0170.07718.13
5.6.190.0130.08320.61
5.6.180.3470.05320.67
5.6.170.0200.04020.50
5.6.160.0070.05320.48
5.6.150.0000.05718.15
5.6.140.0100.07718.28
5.6.130.0170.07718.19
5.6.120.0100.08020.98
5.6.110.0070.08720.98
5.6.100.0000.04721.14
5.6.90.0000.04720.89
5.6.80.0130.05720.38
5.6.70.0200.08020.47
5.5.350.0300.06720.31
5.5.340.0200.05017.99
5.5.330.0170.07720.21
5.5.320.0300.05720.32
5.5.310.0200.04020.42
5.5.300.0030.08318.02
5.5.290.0070.08017.94
5.5.280.0000.06320.77
5.5.270.0100.04720.88
5.5.260.0170.07320.80
5.5.250.0070.06020.58
5.5.240.0170.07320.35
5.4.450.0430.06019.49
5.4.440.0800.06019.61
5.4.430.0700.04719.48
5.4.420.0770.05019.38
5.4.410.0770.04719.45
5.4.400.0330.05018.76
5.4.390.0600.06318.75
5.4.380.0300.06718.85
5.4.370.0200.04318.77
5.4.360.0130.05018.50
5.4.350.0090.03412.03
5.4.340.0080.04112.03
5.4.320.0060.03712.52
5.4.310.0060.04212.52
5.4.300.0080.03312.52
5.4.290.0080.03612.52
5.4.280.0060.03512.41
5.4.270.0050.03712.41
5.4.260.0080.04012.41
5.4.250.0170.07018.95
5.4.240.0000.06718.76
5.4.230.0130.06319.09
5.4.220.0070.06718.83
5.4.210.0030.05718.83
5.4.200.0130.04718.82
5.4.190.0100.07318.79
5.4.180.0100.05718.82
5.4.170.0170.05718.82
5.4.160.0030.05718.75
5.4.150.0030.08318.94
5.4.140.0170.04316.64
5.4.130.0030.05316.61
5.4.120.0130.06716.45
5.4.110.0070.05316.52
5.4.100.0070.05716.49
5.4.90.0070.04716.45
5.4.80.0070.05016.61
5.4.70.0030.05316.65
5.4.60.0030.06016.59
5.4.50.0030.05316.54
5.4.40.0030.05316.51
5.4.30.0030.05716.38
5.4.20.0170.04016.45
5.4.10.0030.05716.38
5.4.00.0070.06315.87
5.3.290.0060.04112.80
5.3.280.0100.07314.77
5.3.270.0200.06714.69
5.3.260.0070.07714.68
5.3.250.0100.05714.44
5.3.240.0100.05314.68
5.3.230.0130.05014.82
5.3.220.0170.07314.40
5.3.210.0100.05014.59
5.3.200.0100.07314.63
5.3.190.0070.05014.62
5.3.180.0170.04714.75
5.3.170.0100.04714.58
5.3.160.0100.05014.40
5.3.150.0170.04014.74
5.3.140.0070.05014.61
5.3.130.0100.05314.55
5.3.120.0100.06714.52
5.3.110.0070.05314.52
5.3.100.0170.04313.87
5.3.90.0100.05014.11
5.3.80.0070.06314.11
5.3.70.0070.05013.85
5.3.60.0000.07714.16
5.3.50.0170.04713.93
5.3.40.0070.05014.01
5.3.30.0070.04713.82
5.3.20.0100.04713.68
5.3.10.0130.06013.48
5.3.00.0100.04713.62
5.2.170.0030.04311.32
5.2.160.0200.03311.10
5.2.150.0030.06711.21
5.2.140.0030.05011.09
5.2.130.0030.06011.20
5.2.120.0030.05311.05
5.2.110.0100.03711.19
5.2.100.0130.05011.18
5.2.90.0170.03710.93
5.2.80.0130.05011.25
5.2.70.0200.03011.08
5.2.60.0070.04711.14
5.2.50.0070.04011.11
5.2.40.0030.04311.23
5.2.30.0070.04310.98
5.2.20.0070.04010.95
5.2.10.0030.06010.95
5.2.00.0100.04710.89
5.1.60.0030.0339.83
5.1.50.0130.03710.05
5.1.40.0000.03710.14
5.1.30.0100.03310.24
5.1.20.0030.04310.51
5.1.10.0070.0339.90
5.1.00.0100.04710.31
5.0.50.0070.0278.74
5.0.40.0070.0308.25
5.0.30.0100.0478.29
5.0.20.0130.0178.17
5.0.10.0000.0308.24
5.0.00.0070.0378.20
4.4.90.0000.0237.00
4.4.80.0030.0237.00
4.4.70.0000.0337.00
4.4.60.0000.0237.00
4.4.50.0030.0207.00
4.4.40.0030.0337.00
4.4.30.0000.0237.00
4.4.20.0030.0277.00
4.4.10.0070.0277.00
4.4.00.0000.0377.00
4.3.110.0030.0237.00
4.3.100.0030.0207.00
4.3.90.0070.0177.00
4.3.80.0030.0377.00
4.3.70.0030.0307.00
4.3.60.0030.0207.00
4.3.50.0000.0237.00
4.3.40.0000.0477.00
4.3.30.0000.0337.00
4.3.20.0000.0377.00
4.3.10.0000.0237.00
4.3.00.0130.0277.66

preferences:
52.99 ms | 401 KiB | 5 Q