3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Example 1 -- Unpacking the array to do work on it array_map(function ($x) { $first_name = $x[0]; $last_name = $x[1]; // Do important work here with first_name and last_name... // But $first_name and $last_name are scoped to this function // See the second example for how we'd inject an anonymous function to operate with $first_name and $last_name }, [ ['John', 'Galt'], ['Howard', 'Roark'], ]); // Example 2 -- Separation of input setup and behavior $behavior = function ($first_name, $last_name) { var_dump('Doing hard work!', $first_name, $last_name); }; array_map(function ($x) use ($behavior) { $first_name = $x[0]; $last_name = $x[1]; // $behavior is invoked using our unpacked arguments $behavior($first_name, $last_name); }, [ ['John', 'Galt'], ['Howard', 'Roark'], ]);

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.4.130.0120.00817.72
8.4.120.0040.00420.86
8.4.110.0120.00922.71
8.4.100.0100.01218.04
8.4.90.0160.00517.81
8.4.80.0120.00822.34
8.4.70.0090.00417.90
8.4.60.0110.00918.96
8.4.50.0100.01020.66
8.4.40.0170.00317.54
8.4.30.0080.00019.38
8.4.20.0130.00717.75
8.4.10.0060.00317.63
8.3.260.0120.00416.36
8.3.250.0130.00519.06
8.3.240.0150.00416.55
8.3.230.0120.00816.86
8.3.220.0110.00717.17
8.3.210.0130.00616.56
8.3.200.0040.00516.51
8.3.190.0060.00517.05
8.3.180.0060.00918.86
8.3.170.0070.01116.59
8.3.160.0180.00417.05
8.3.150.0130.00618.99
8.3.140.0040.00417.10
8.3.130.0110.00016.59
8.3.120.0090.00920.88
8.3.110.0090.00020.94
8.3.100.0060.00324.06
8.3.90.0090.00618.23
8.3.80.0040.00418.30
8.3.70.0090.00918.56
8.3.60.0080.00818.53
8.3.50.0160.00521.12
8.3.40.0070.01018.80
8.3.30.0110.00718.98
8.3.20.0000.00720.16
8.3.10.0000.00721.86
8.3.00.0000.00819.21
8.2.290.0090.01020.75
8.2.280.0110.00918.24
8.2.270.0150.00316.60
8.2.260.0100.01016.70
8.2.250.0030.00618.36
8.2.240.0000.00817.29
8.2.230.0090.00022.58
8.2.220.0060.00337.54
8.2.210.0110.00426.77
8.2.200.0090.00016.63
8.2.190.0160.00316.88
8.2.180.0140.00716.63
8.2.170.0150.00022.96
8.2.160.0100.00320.44
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0050.00320.98
8.2.110.0040.00420.38
8.2.100.0070.00417.91
8.2.90.0060.00320.63
8.2.80.0060.00317.97
8.2.70.0080.00017.93
8.2.60.0060.00318.05
8.2.50.0030.00618.10
8.2.40.0000.00719.25
8.2.30.0040.00419.43
8.2.20.0000.00717.68
8.2.10.0040.00418.20
8.2.00.0040.00417.79
8.1.330.0110.00819.82
8.1.320.0120.00718.07
8.1.310.0000.00716.75
8.1.300.0000.00917.98
8.1.290.0060.00318.88
8.1.280.0070.00725.92
8.1.270.0060.00318.88
8.1.260.0050.00226.35
8.1.250.0040.00428.09
8.1.240.0100.00723.73
8.1.230.0090.00320.96
8.1.220.0040.00417.79
8.1.210.0080.00019.09
8.1.200.0030.00617.35
8.1.190.0050.00317.35
8.1.180.0030.00518.10
8.1.170.0000.00818.45
8.1.160.0000.00818.88
8.1.150.0000.00718.78
8.1.140.0030.00617.50
8.1.130.0000.00717.82
8.1.120.0050.00217.52
8.1.110.0070.00017.34
8.1.100.0060.00317.38
8.1.90.0000.00717.51
8.1.80.0040.00417.46
8.1.70.0040.00417.46
8.1.60.0040.00417.59
8.1.50.0070.00017.43
8.1.40.0000.00717.57
8.1.30.0040.00417.66
8.1.20.0040.00417.59
8.1.10.0030.00617.45
8.1.00.0000.00817.52
8.0.300.0000.00719.88
8.0.290.0030.00616.75
8.0.280.0030.00318.37
8.0.270.0030.00317.32
8.0.260.0000.00617.30
8.0.250.0030.00317.00
8.0.240.0000.00716.93
8.0.230.0070.00016.84
8.0.220.0000.00716.79
8.0.210.0000.00716.90
8.0.200.0030.00316.83
8.0.190.0050.00316.89
8.0.180.0000.00716.91
8.0.170.0040.00416.96
8.0.160.0000.00716.89
8.0.150.0000.00716.84
8.0.140.0040.00416.85
8.0.130.0030.00313.40
8.0.120.0080.00016.88
8.0.110.0040.00416.89
8.0.100.0070.00016.84
8.0.90.0040.00416.91
8.0.80.0110.00616.94
8.0.70.0040.00416.77
8.0.60.0040.00416.79
8.0.50.0070.00016.87
8.0.30.0090.01417.05
8.0.20.0080.01117.40
8.0.10.0000.00716.92
8.0.00.0070.01016.75
7.4.330.0000.00815.03
7.4.320.0030.00316.40
7.4.300.0040.00416.53
7.4.290.0040.00416.41
7.4.280.0030.00416.52
7.4.270.0000.00716.63
7.4.260.0000.00716.45
7.4.250.0050.00316.61
7.4.240.0020.00516.44
7.4.230.0030.00316.56
7.4.220.0100.01616.59
7.4.210.0070.00916.50
7.4.200.0000.00716.61
7.4.160.0090.00616.39
7.4.150.0130.00617.40
7.4.140.0070.01117.86
7.4.130.0120.00716.55
7.4.120.0110.00716.48
7.4.110.0090.01616.71
7.4.100.0060.01216.45
7.4.90.0100.00716.41
7.4.80.0040.01319.39
7.4.70.0100.00616.46
7.4.60.0060.00916.43
7.4.50.0040.00416.19
7.4.40.0120.00616.52
7.4.30.0140.00316.48
7.4.00.0100.00614.98
7.3.330.0060.00013.43
7.3.320.0000.00713.16
7.3.310.0030.00316.41
7.3.300.0000.00716.20
7.3.290.0000.00716.27
7.3.280.0110.00616.31
7.3.270.0100.01317.40
7.3.260.0150.00616.49
7.3.250.0060.01216.48
7.3.240.0100.00716.27
7.3.230.0000.01816.42
7.3.210.0140.00316.47
7.3.200.0070.01019.39
7.3.190.0160.00016.37
7.3.180.0030.01416.59
7.3.170.0080.00816.41
7.3.160.0080.00816.46
7.2.330.0040.01516.50
7.2.320.0140.00316.53
7.2.310.0030.01416.40
7.2.300.0060.01016.37
7.2.290.0060.01116.49
7.2.60.0100.00316.76
7.2.00.0040.00819.20
7.1.200.0080.00015.81
7.1.100.0040.00717.72
7.1.70.0000.00717.17
7.1.60.0030.02119.57
7.1.50.0070.01716.87
7.1.00.0030.07722.45
7.0.200.0030.00716.82
7.0.140.0030.07322.12
7.0.60.0030.08019.87
7.0.50.0100.07317.72
7.0.40.0100.03720.25
7.0.30.0300.09020.23
7.0.20.0270.04320.23
7.0.10.0070.07720.25
7.0.00.0070.08720.05
5.6.280.0070.07020.90
5.6.210.0130.07020.75
5.6.200.0070.08718.29
5.6.190.0000.04720.49
5.6.180.0470.07020.48
5.6.170.0270.04020.55
5.6.160.0130.07720.50
5.6.150.0070.03718.25
5.6.140.0030.04718.18
5.6.130.0070.07318.14
5.6.120.0100.04721.02
5.6.110.0070.08721.14
5.6.100.0130.08320.98
5.6.90.0070.04721.14
5.6.80.0100.07020.39
5.5.350.0200.07720.48
5.5.340.0070.08018.07
5.5.330.0000.04320.46
5.5.320.0470.06720.35
5.5.310.0130.05020.35
5.5.300.0030.08717.95
5.5.290.0070.05717.92
5.5.280.0000.06020.78
5.5.270.0030.04020.84
5.5.260.0070.08320.80
5.5.250.0130.04320.69
5.5.240.0000.07320.16
5.4.450.0600.05319.34
5.4.440.0970.07019.58
5.4.430.0030.06019.32
5.4.420.0170.04719.36
5.4.410.0200.04319.21
5.4.400.0030.06019.33
5.4.390.0070.05719.13
5.4.380.0170.05718.57
5.4.370.0200.05018.73
5.4.360.0230.05318.48
5.4.350.0130.05718.79
5.4.340.0200.05018.48
5.4.320.0300.04018.84
5.4.310.0230.05718.72
5.4.300.0100.06318.76
5.4.290.0230.05018.59
5.4.280.0100.06318.62
5.4.270.0270.04718.50
5.4.260.0130.07718.61
5.4.250.0200.05718.75
5.4.240.0330.04718.72
5.4.230.0230.05018.79
5.4.220.0270.05318.46
5.4.210.0230.05018.73
5.4.200.0170.05016.63
5.4.190.0270.04718.72
5.4.180.0200.05018.57
5.4.170.0170.05718.46
5.4.160.0170.05718.75
5.4.150.0170.05318.54
5.4.140.0230.05316.38
5.4.130.0170.04716.45
5.4.120.0170.05716.30
5.4.110.0130.05016.21
5.4.100.0070.06016.37
5.4.90.0230.04716.21
5.4.80.0230.04016.32
5.4.70.0270.03716.28
5.4.60.0270.04016.15
5.4.50.0300.04016.29
5.4.40.0230.04316.29
5.4.30.0200.04716.30
5.4.20.0200.05016.14
5.4.10.0270.05716.22
5.4.00.0170.05015.74
5.3.290.0200.05314.80
5.3.280.0130.05714.82
5.3.270.0230.04714.74
5.3.260.0270.04314.58
5.3.250.0300.03714.60
5.3.240.0130.05314.74
5.3.230.0200.05014.70
5.3.220.0170.05314.59
5.3.210.0200.05314.61
5.3.200.0100.05714.73
5.3.190.0230.04714.70
5.3.180.0100.06714.67
5.3.170.0230.04314.75
5.3.160.0170.07714.60
5.3.150.0170.07314.73
5.3.140.0170.07014.66
5.3.130.0270.06314.59
5.3.120.0300.04314.56
5.3.110.0230.05014.75
5.3.100.0300.03714.08
5.3.90.0100.05714.08
5.3.80.0200.04714.21
5.3.70.0100.05714.09
5.3.60.0130.05314.21
5.3.50.0130.05314.02
5.3.40.0200.05713.95
5.3.30.0100.05314.01
5.3.20.0200.05013.74
5.3.10.0100.05713.66
5.3.00.0170.05013.68
5.2.170.0300.02711.12
5.2.160.0170.04011.10
5.2.150.0130.04711.18
5.2.140.0130.04311.11
5.2.130.0070.04711.08
5.2.120.0200.03311.15
5.2.110.0100.04311.14
5.2.100.0170.04011.15
5.2.90.0130.04311.05
5.2.80.0100.04711.16
5.2.70.0230.03311.04
5.2.60.0270.04711.03
5.2.50.0200.03711.05
5.2.40.0200.05010.94
5.2.30.0130.06010.93
5.2.20.0070.04710.98
5.2.10.0130.03710.91
5.2.00.0170.04010.71
5.1.60.0270.0309.96
5.1.50.0130.03010.01
5.1.40.0130.03010.03
5.1.30.0130.03310.48
5.1.20.0070.04010.50
5.1.10.0070.04010.11
5.1.00.0200.02710.13
5.0.50.0130.0238.62
5.0.40.0100.0238.43
5.0.30.0100.0408.19
5.0.20.0070.0278.21
5.0.10.0070.0278.28
5.0.00.0070.0438.19
4.4.90.0070.0205.92
4.4.80.0070.0205.82
4.4.70.0030.0235.93
4.4.60.0030.0235.86
4.4.50.0130.0135.91
4.4.40.0130.0305.91
4.4.30.0030.0235.87
4.4.20.0030.0275.98
4.4.10.0130.0135.88
4.4.00.0000.0405.95
4.3.110.0030.0235.80
4.3.100.0070.0205.82
4.3.90.0070.0205.78
4.3.80.0030.0375.79
4.3.70.0030.0235.86
4.3.60.0070.0205.82
4.3.50.0070.0205.82
4.3.40.0000.0405.74
4.3.30.0030.0234.73
4.3.20.0100.0174.73
4.3.10.0100.0174.73
4.3.00.0070.0236.95

preferences:
148.33 ms | 403 KiB | 5 Q