3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_flatten_iterator (array $array) { foreach ($array as $value) { if (is_array($value)) { yield from array_flatten_iterator($value); } else { yield $value; } } } function array_flatten (array $array) { return iterator_to_array(array_flatten_iterator($array), false); } $array = [ 1, 2, [ 3, 4, 5, [ 6, 7 ], 8, 9, ], 10, 11, ]; var_dump(array_flatten($array));

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.130.0000.01118.37
8.3.120.0110.00718.90
8.3.110.0030.00616.65
8.3.100.0140.00718.40
8.3.90.0050.00326.77
8.3.80.0030.00616.48
8.3.70.0120.00916.61
8.3.60.0070.01116.63
8.3.50.0120.00521.98
8.3.40.0100.01018.60
8.3.30.0110.00418.96
8.3.20.0030.00520.39
8.3.10.0000.00823.56
8.3.00.0080.00019.17
8.2.250.0030.00616.71
8.2.240.0050.00319.02
8.2.230.0050.00520.94
8.2.220.0170.00337.54
8.2.210.0000.00826.77
8.2.200.0000.00918.29
8.2.190.0140.00718.16
8.2.180.0170.00725.92
8.2.170.0170.00318.79
8.2.160.0100.00322.96
8.2.150.0040.00425.66
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0060.00317.50
8.2.110.0080.00322.08
8.2.100.0000.01117.91
8.2.90.0030.00617.90
8.2.80.0000.00818.04
8.2.70.0090.00617.30
8.2.60.0090.00417.58
8.2.50.0070.00717.71
8.2.40.0060.00617.86
8.2.30.0070.00517.90
8.2.20.0000.00817.59
8.2.10.0060.00718.65
8.2.00.0070.00417.90
8.1.300.0050.00320.20
8.1.290.0060.00330.84
8.1.280.0100.00725.92
8.1.270.0040.00424.66
8.1.260.0000.00926.35
8.1.250.0060.00328.09
8.1.240.0080.00023.92
8.1.230.0040.00822.72
8.1.220.0000.00720.88
8.1.210.0080.00018.78
8.1.200.0070.00617.25
8.1.190.0080.00417.30
8.1.180.0080.00417.49
8.1.170.0090.00417.78
8.1.160.0060.00619.49
8.1.150.0080.00517.98
8.1.140.0080.00417.22
8.1.130.0040.00817.25
8.1.120.0060.00617.36
8.1.110.0060.00617.22
8.1.100.0090.00217.29
8.1.90.0110.00217.30
8.1.80.0070.00517.17
8.1.70.0050.00617.29
8.1.60.0090.00417.37
8.1.50.0130.00217.33
8.1.40.0080.00317.48
8.1.30.0020.01117.43
8.1.20.0110.00317.41
8.1.10.0060.00717.16
8.1.00.0100.00417.29
8.0.300.0040.00419.65
8.0.290.0050.00716.67
8.0.280.0100.00217.48
8.0.270.0090.00416.81
8.0.260.0090.00417.51
8.0.250.0100.00216.77
8.0.240.0080.00516.80
8.0.230.0060.00716.72
8.0.220.0060.00716.67
8.0.210.0070.00516.71
8.0.200.0080.00416.76
8.0.190.0060.00616.80
8.0.180.0040.00816.76
8.0.170.0080.00416.70
8.0.160.0040.00716.73
8.0.150.0070.00516.69
8.0.140.0040.00816.84
8.0.130.0060.00614.95
8.0.120.0080.00316.74
8.0.110.0080.00416.74
8.0.100.0080.00516.66
8.0.90.0040.00716.67
8.0.80.0110.00616.71
8.0.70.0060.00616.64
8.0.60.0090.00316.68
8.0.50.0070.00516.67
8.0.30.0120.00716.88
8.0.20.0070.01317.18
8.0.10.0110.00116.79
8.0.00.0100.00816.79
7.4.330.0080.00115.87
7.4.320.0070.00316.55
7.4.300.0070.00416.53
7.4.290.0090.00216.50
7.4.280.0100.00316.54
7.4.270.0070.00416.54
7.4.260.0070.00516.51
7.4.250.0070.00516.57
7.4.240.0060.00416.55
7.4.230.0110.00116.46
7.4.220.0150.00416.65
7.4.210.0080.00816.54
7.4.200.0060.00516.60
7.4.190.0000.01516.58
7.4.180.0120.00316.58
7.4.160.0090.00616.50
7.4.150.0130.00616.99
7.4.140.0130.00617.43
7.4.130.0130.00416.45
7.4.120.0130.00416.51
7.4.110.0070.01016.54
7.4.100.0130.00716.54
7.4.90.0110.00516.44
7.4.80.0110.00517.26
7.4.70.0100.00716.43
7.4.60.0110.00616.51
7.4.50.0080.00716.48
7.4.40.0080.01016.52
7.4.30.0130.00516.32
7.4.20.0110.00716.56
7.4.10.0110.00616.50
7.4.00.0090.00915.66
7.3.330.0050.00514.86
7.3.320.0100.00014.96
7.3.310.0050.00516.41
7.3.300.0110.00016.42
7.3.290.0090.00216.41
7.3.280.0070.00916.42
7.3.270.0100.00616.99
7.3.260.0170.00016.60
7.3.250.0090.00916.46
7.3.240.0110.00516.60
7.3.230.0110.00716.49
7.3.220.0150.00016.58
7.3.210.0110.00716.47
7.3.200.0100.00716.38
7.3.190.0120.00716.45
7.3.180.0120.00716.41
7.3.170.0120.00716.47
7.3.160.0090.01116.46
7.3.150.0090.00916.46
7.3.140.0110.00616.42
7.3.130.0110.00816.45
7.3.120.0090.00915.77
7.3.110.0110.00615.76
7.3.100.0080.01015.87
7.3.90.0090.00715.82
7.3.80.0090.00715.88
7.3.70.0080.00815.84
7.3.60.0080.00815.87
7.3.50.0090.00715.74
7.3.40.0080.00815.84
7.3.30.0090.00715.80
7.3.20.0110.00616.73
7.3.10.0060.01116.77
7.3.00.0080.00716.73
7.2.340.0050.00516.42
7.2.330.0080.00916.61
7.2.320.0110.00816.57
7.2.310.0120.00916.53
7.2.300.0080.01016.57
7.2.290.0100.00916.55
7.2.280.0080.00916.67
7.2.270.0070.01116.68
7.2.260.0060.01116.61
7.2.250.0080.01115.94
7.2.240.0090.00915.99
7.2.230.0090.00815.92
7.2.220.0070.00916.00
7.2.210.0090.00815.96
7.2.200.0060.01015.98
7.2.190.0080.00815.92
7.2.180.0080.00815.89
7.2.170.0070.01115.96
7.2.160.0050.01416.61
7.2.150.0120.00817.03
7.2.140.0150.00817.09
7.2.130.0100.00917.01
7.2.120.0120.00817.15
7.2.110.0100.01017.06
7.2.100.0090.00817.18
7.2.90.0090.01117.09
7.2.80.0120.00717.20
7.2.70.0110.00817.12
7.2.60.0070.01216.92
7.2.50.0080.01017.12
7.2.40.0120.00717.18
7.2.30.0120.00817.15
7.2.20.0370.00517.13
7.2.10.0150.00317.08
7.2.00.0120.00917.14
7.1.330.0140.00915.95
7.1.320.0190.00715.95
7.1.310.0120.00815.88
7.1.300.0120.00915.85
7.1.290.0100.01015.94
7.1.280.0150.00715.85
7.1.270.0150.00615.90
7.1.260.0140.00715.90
7.1.250.0160.00815.85
7.1.240.0180.00615.81
7.1.230.0330.00415.86
7.1.220.0160.00615.92
7.1.210.0180.00715.93
7.1.200.0120.00815.78
7.1.190.0140.01215.79
7.1.180.0150.00915.89
7.1.170.0180.00615.78
7.1.160.0130.01015.97
7.1.150.0200.00615.71
7.1.140.0160.00715.84
7.1.130.0160.00815.73
7.1.120.0150.01015.85
7.1.110.0160.01115.94
7.1.100.0180.00615.79
7.1.90.0160.00715.76
7.1.80.0200.00615.98
7.1.70.0120.00716.05
7.1.60.0160.00616.81
7.1.50.0140.00916.13
7.1.40.0220.00615.84
7.1.30.0170.00615.85
7.1.20.0150.01015.74
7.1.10.0110.01115.83
7.1.00.0170.02117.51
7.0.330.0130.00915.67
7.0.320.0130.01015.74
7.0.310.0140.01115.64
7.0.300.0200.00915.74
7.0.290.0150.01015.64
7.0.280.0160.00815.65
7.0.270.0170.00815.52
7.0.260.0210.00615.70
7.0.250.0160.00815.82
7.0.240.0130.01115.69
7.0.230.0190.00915.85
7.0.220.0190.00615.71
7.0.210.0160.00815.75
7.0.200.0160.00515.96
7.0.190.0260.00815.74
7.0.180.0140.01015.81
7.0.170.0190.00615.81
7.0.160.0180.00715.79
7.0.150.0150.00715.77
7.0.140.0170.00815.72
7.0.130.0140.01015.73
7.0.120.0150.00715.72
7.0.110.0150.00715.73
7.0.100.0200.00615.75
7.0.90.0170.00915.67
7.0.80.0230.02616.84
7.0.70.0180.01716.79
7.0.60.0170.01716.80
7.0.50.0130.01916.92
7.0.40.0150.02616.82
7.0.30.0180.02316.80
7.0.20.0170.02116.83
7.0.10.0170.02316.86
7.0.00.0210.02316.80
5.6.400.0190.00715.87
5.6.390.0160.00815.81
5.6.380.0110.01215.92
5.6.370.0160.00815.91
5.6.360.0190.00515.82
5.6.350.0120.01015.87
5.6.340.0140.01015.76
5.6.330.0210.00315.93
5.6.320.0100.01415.85
5.6.310.0190.00716.07
5.6.300.0150.00915.92
5.6.290.0200.00615.94
5.6.280.0150.02217.21
5.6.270.0150.00915.95
5.6.260.0150.00915.98
5.6.250.0190.00515.85
5.6.240.0140.02617.15
5.6.230.0140.01817.17
5.6.220.0160.01317.14
5.6.210.0140.01617.15
5.6.200.0170.01917.34
5.6.190.0140.02517.24
5.6.180.0170.01517.27
5.6.170.0160.01917.31
5.6.160.0130.02317.22
5.6.150.0160.02917.18
5.6.140.0130.01917.26
5.6.130.0160.01717.30
5.6.120.0150.02417.27
5.6.110.0190.01817.27
5.6.100.0140.02217.21
5.6.90.0150.02617.27
5.6.80.0170.01517.06
5.6.70.0090.03017.12
5.6.60.0150.02617.03
5.6.50.0130.02917.02
5.6.40.0130.02317.03
5.6.30.0150.02317.03
5.6.20.0150.02417.07
5.6.10.0150.02717.08
5.6.00.0140.02717.05
5.5.380.0210.00515.95
5.5.370.0140.01517.06
5.5.360.0120.02016.96
5.5.350.0150.01617.10
5.5.340.0130.02117.14
5.5.330.0160.01417.08
5.5.320.0110.02117.15
5.5.310.0190.02217.18
5.5.300.0150.02617.10
5.5.290.0110.02917.20
5.5.280.0170.02317.18
5.5.270.0210.01717.20
5.5.260.0190.01917.18
5.5.250.0160.01917.14
5.5.240.0150.02017.02
5.5.230.0160.01917.02
5.5.220.0130.02616.98
5.5.210.0110.01916.97
5.5.200.0140.02716.92
5.5.190.0120.02517.02
5.5.180.0180.02317.05
5.5.170.0120.01415.88
5.5.160.0190.02116.98
5.5.150.0200.02017.02
5.5.140.0100.03016.97
5.5.130.0130.02216.97
5.5.120.0150.02317.01
5.5.110.0140.02716.92
5.5.100.0090.03016.95
5.5.90.0150.02516.94
5.5.80.0110.02716.92
5.5.70.0120.02516.89
5.5.60.0160.02216.96
5.5.50.0150.02716.98
5.5.40.0130.02616.92
5.5.30.0160.02216.93
5.5.20.0160.02416.88
5.5.10.0190.01416.93
5.5.00.0120.02716.92
5.4.450.0120.02615.21
5.4.440.0140.02315.30
5.4.430.0140.02315.22
5.4.420.0100.01615.17
5.4.410.0120.01615.18
5.4.400.0110.01715.12
5.4.390.0150.01915.21
5.4.380.0150.01215.13
5.4.370.0120.02415.10
5.4.360.0140.02015.07
5.4.350.0130.02315.08
5.4.340.0190.01415.16
5.4.330.0150.00413.85
5.4.320.0150.01515.16
5.4.310.0140.02215.07
5.4.300.0140.02215.11
5.4.290.0110.02715.08
5.4.280.0130.01415.09
5.4.270.0120.02415.04
5.4.260.0140.02315.13
5.4.250.0100.02615.04
5.4.240.0120.02415.08
5.4.230.0130.01615.14
5.4.220.0090.02415.12
5.4.210.0140.02315.11
5.4.200.0110.02215.16
5.4.190.0170.01915.12
5.4.180.0120.02215.04
5.4.170.0120.02015.09
5.4.160.0100.02515.07
5.4.150.0110.02415.13
5.4.140.0120.01814.40
5.4.130.0140.02114.44
5.4.120.0120.01714.50
5.4.110.0110.02314.52
5.4.100.0150.01814.43
5.4.90.0110.02414.45
5.4.80.0120.02114.38
5.4.70.0120.02114.48
5.4.60.0110.02114.49
5.4.50.0070.02214.47
5.4.40.0100.01814.47
5.4.30.0100.02514.46
5.4.20.0120.02214.47
5.4.10.0080.02914.44
5.4.00.0130.02114.32

preferences:
29.71 ms | 403 KiB | 5 Q