3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo (iterable $ints) { $actualInts = []; foreach ($ints as $int) { $actualInts[] = (function (int $int): int { return $int; })($int); } return $actualInts; } function bar (iterable $ints) { $actualInts = (function (int ... $ints): array { return $ints; })(... array_values(is_array($ints) ? $ints : iterator_to_array($ints))); return $actualInts; } function getIt(): Generator { yield '1'; yield 3; } var_dump(foo(['1', 3])); var_dump(foo(getIt())); var_dump(bar(['1', 3])); var_dump(bar(getIt()));

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.0070.00718.43
8.3.50.0070.00716.20
8.3.40.0150.00318.85
8.3.30.0090.01218.70
8.3.20.0070.00021.86
8.3.10.0060.00320.52
8.3.00.0080.00019.26
8.2.180.0160.00018.30
8.2.170.0110.00422.96
8.2.160.0150.00419.51
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0050.00326.16
8.2.120.0080.00019.97
8.2.110.0070.00321.01
8.2.100.0080.00417.84
8.2.90.0050.00317.88
8.2.80.0000.00817.97
8.2.70.0040.00418.16
8.2.60.0000.00818.22
8.2.50.0000.00818.10
8.2.40.0040.00420.87
8.2.30.0000.00719.38
8.2.20.0050.00218.05
8.2.10.0040.00421.21
8.2.00.0000.00718.20
8.1.280.0150.00025.92
8.1.270.0000.00820.43
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0050.00521.12
8.1.230.0000.01117.83
8.1.220.0090.00017.78
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0050.00317.35
8.1.180.0040.00418.10
8.1.170.0040.00418.49
8.1.160.0040.00418.84
8.1.150.0000.00718.86
8.1.140.0030.00520.27
8.1.130.0060.00420.18
8.1.120.0040.00317.51
8.1.110.0040.00417.46
8.1.100.0040.00417.44
8.1.90.0070.00017.50
8.1.80.0000.00817.30
8.1.70.0030.00317.35
8.1.60.0000.00717.57
8.1.50.0040.00417.54
8.1.40.0060.00317.51
8.1.30.0060.00317.55
8.1.20.0000.00817.59
8.1.10.0040.00417.50
8.1.00.0030.00617.43
8.0.300.0040.00418.77
8.0.290.0030.00516.63
8.0.280.0070.00018.46
8.0.270.0070.00016.93
8.0.260.0000.01018.45
8.0.250.0030.00316.98
8.0.240.0050.00316.94
8.0.230.0050.00317.01
8.0.220.0000.00816.88
8.0.210.0000.00716.82
8.0.200.0040.00417.06
8.0.190.0000.00716.88
8.0.180.0000.00817.01
8.0.170.0030.00616.99
8.0.160.0000.00716.85
8.0.150.0050.00316.79
8.0.140.0030.00516.83
8.0.130.0050.00013.36
8.0.120.0000.00916.93
8.0.110.0040.00416.94
8.0.100.0080.00016.85
8.0.90.0050.00216.87
8.0.80.0090.00616.93
8.0.70.0070.00017.07
8.0.60.0040.00417.02
8.0.50.0000.00716.95
8.0.30.0120.00717.11
8.0.20.0100.01017.04
8.0.10.0040.00417.04
8.0.00.0100.01116.77
7.4.330.0020.00215.55
7.4.320.0040.00416.58
7.4.300.0060.00016.36
7.4.290.0030.00316.59
7.4.280.0030.00516.40
7.4.270.0030.00416.49
7.4.260.0070.00016.47
7.4.250.0040.00416.46
7.4.240.0000.00716.52
7.4.230.0030.00316.57
7.4.220.0060.00316.39
7.4.210.0050.00916.61
7.4.200.0000.00716.61
7.4.160.0100.00716.53
7.4.140.0160.00017.86
7.4.130.0070.01016.61
7.4.120.0120.00616.39
7.4.110.0090.00916.56
7.4.100.0130.01016.45
7.4.90.0130.01016.70
7.4.80.0060.01017.81
7.4.70.0180.00516.52
7.4.60.0170.00216.22
7.4.50.0110.00816.23
7.4.40.0110.00816.19
7.4.30.0280.00016.40
7.4.20.0120.01016.32
7.4.10.0130.00915.48
7.4.00.0070.01015.32
7.3.330.0080.00013.26
7.3.320.0000.00513.31
7.3.310.0070.00016.33
7.3.300.0000.00716.33
7.3.290.0060.00016.36
7.3.280.0110.01016.30
7.3.260.0100.00916.42
7.3.240.0120.00816.52
7.3.230.0030.01316.39
7.3.210.0030.01416.45
7.3.200.0100.00916.12
7.3.190.0100.01016.19
7.3.180.0130.00616.32
7.3.170.0070.01416.51
7.3.160.0160.00616.29
7.3.150.0150.00816.04
7.3.140.0110.01116.39
7.3.130.0110.00815.65
7.3.120.0150.00615.75
7.3.110.0110.01015.47
7.3.100.0200.00315.74
7.3.90.0180.00415.65
7.3.80.0120.00815.96
7.3.70.0120.01115.65
7.3.60.0140.01115.63
7.3.50.0150.00915.38
7.3.40.0140.01115.65
7.3.30.0130.01015.52
7.3.20.0440.00815.66
7.3.10.0310.00915.88
7.3.00.0310.00815.89
7.2.330.0090.00916.54
7.2.320.0000.02216.65
7.2.310.0100.01016.52
7.2.300.0150.00816.68
7.2.290.0130.00916.69
7.2.280.0150.00816.70
7.2.270.0080.01316.71
7.2.260.0120.00815.93
7.2.250.0130.00715.87
7.2.240.0110.01115.97
7.2.230.0160.00515.80
7.2.220.0130.01115.80
7.2.210.0150.01115.98
7.2.200.0140.01015.95
7.2.190.0150.00915.89
7.2.180.0190.00815.85
7.2.170.0150.00815.87
7.2.160.0150.00915.93
7.2.150.0320.00616.27
7.2.140.0300.01016.14
7.2.130.0340.01216.29
7.2.120.0280.00916.26
7.2.110.0290.01016.28
7.2.100.0500.01116.28
7.2.90.0410.00516.24
7.2.80.0320.01116.31
7.2.70.0350.00816.34
7.2.60.0350.00516.16
7.2.50.0370.00216.25
7.2.40.0100.01316.19
7.2.30.0320.00916.20
7.2.20.0280.00816.08
7.2.10.0270.01116.14
7.2.00.0320.00615.98
7.1.330.0110.00615.71
7.1.320.0030.01415.75
7.1.310.0090.01115.64
7.1.300.0070.00915.75
7.1.290.0100.00615.71
7.1.280.0070.01015.80
7.1.270.0100.00715.65
7.1.260.0080.01015.63
7.1.250.0320.00515.24
7.1.240.0090.00815.65
7.1.230.0080.00715.59
7.1.220.0080.01115.70
7.1.210.0090.00315.54
7.1.200.0080.00815.61
7.1.190.0060.01015.54
7.1.180.0060.00915.71
7.1.170.0140.00615.67
7.1.160.0090.01015.71
7.1.150.0130.00915.51
7.1.140.0140.00615.83
7.1.130.0220.00915.59
7.1.120.0130.01015.63
7.1.110.0230.00915.65
7.1.100.0140.01215.76
7.1.90.0130.01015.76
7.1.80.0140.00715.80
7.1.70.0100.00815.63
7.1.60.0130.00615.81
7.1.50.0130.00715.71
7.1.40.0070.01015.73
7.1.30.0100.00415.72
7.1.20.0080.00815.77
7.1.10.0070.01015.71
7.1.00.0110.00615.76

preferences:
55.75 ms | 400 KiB | 5 Q