3v4l.org

run code in 300+ PHP versions simultaneously
<?php $list_of_lists_of_lists = [[1, 2, [3]], [4, 3, 4, [5, 3, 4]], 3]; $flattened_list = []; function flatten($l){ foreach ($l as $value) { if (is_array($value)) { returnflatten($value); }else{ $flattened_list[] = $value; } } return $flattened_list; } $flattened_list = flatten($list_of_lists_of_lists); print_r($flattened_list);

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.40.0130.01019.02
8.3.30.0070.00718.70
8.3.20.0120.00620.21
8.3.10.0090.00921.90
8.3.00.0110.00723.61
8.2.170.0180.00422.96
8.2.160.0170.00320.52
8.2.150.0030.01624.18
8.2.140.0050.00324.66
8.2.130.0040.00419.85
8.2.120.0050.00326.35
8.2.110.0070.00421.25
8.2.100.0110.00017.72
8.2.90.0090.00019.19
8.2.80.0050.00317.97
8.2.70.0040.00417.50
8.2.60.0030.00517.93
8.2.50.0040.00418.10
8.2.40.0100.00720.22
8.2.30.0070.00019.47
8.2.20.0000.00817.82
8.2.10.0040.00418.12
8.2.00.0030.00518.04
8.1.270.0000.00923.84
8.1.260.0070.00028.09
8.1.250.0060.00328.09
8.1.240.0040.00723.83
8.1.230.0040.00719.48
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0060.00317.35
8.1.190.0000.00817.23
8.1.180.0040.00418.10
8.1.170.0030.00518.70
8.1.160.0070.00020.76
8.1.150.0050.00318.80
8.1.140.0030.00519.56
8.1.130.0040.00417.70
8.1.120.0030.00717.44
8.1.110.0000.00717.42
8.1.100.0040.00417.38
8.1.90.0000.00817.50
8.1.80.0000.00817.52
8.1.70.0040.00417.30
8.1.60.0040.00417.64
8.1.50.0000.00817.40
8.1.40.0040.00417.52
8.1.30.0030.00617.67
8.1.20.0040.00417.55
8.1.10.0040.00417.56
8.1.00.0040.00417.52
8.0.300.0040.00418.77
8.0.290.0000.00816.75
8.0.280.0030.00318.32
8.0.270.0000.00717.18
8.0.260.0030.00317.27
8.0.250.0090.00017.00
8.0.240.0000.00716.91
8.0.230.0040.00417.00
8.0.220.0040.00416.92
8.0.210.0070.00016.96
8.0.200.0030.00316.88
8.0.190.0040.00716.90
8.0.180.0050.00316.84
8.0.170.0000.00816.96
8.0.160.0040.00416.86
8.0.150.0070.00016.89
8.0.140.0000.00716.88
8.0.130.0050.00013.29
8.0.120.0040.00416.89
8.0.110.0040.00416.93
8.0.100.0020.00517.01
8.0.90.0080.00017.01
8.0.80.0040.01216.96
8.0.70.0000.00816.80
8.0.60.0040.00416.73
8.0.50.0020.00516.98
8.0.30.0080.01016.97
8.0.20.0110.00817.40
8.0.10.0050.00316.95
8.0.00.0080.00916.83
7.4.330.0050.00016.76
7.4.320.0060.00016.50
7.4.300.0030.00516.42
7.4.290.0000.01016.45
7.4.280.0040.00416.40
7.4.270.0000.00716.51
7.4.260.0030.00316.48
7.4.250.0000.00716.46
7.4.240.0060.00216.53
7.4.230.0030.00316.35
7.4.220.0060.01216.63
7.4.210.0070.00716.64
7.4.200.0040.00416.67
7.4.160.0060.01116.50
7.4.150.0100.00717.40
7.4.140.0080.01217.86
7.4.130.0080.01216.48
7.4.120.0060.01116.64
7.4.110.0140.01016.45
7.4.100.0070.01116.45
7.4.90.0070.01116.59
7.4.80.0140.00719.39
7.4.70.0170.00716.45
7.4.60.0090.00616.53
7.4.50.0030.00916.59
7.4.40.0000.01616.38
7.4.30.0130.00916.40
7.4.10.0120.00415.19
7.4.00.0070.00914.95
7.3.330.0040.00413.22
7.3.320.0030.00513.28
7.3.310.0040.00416.34
7.3.300.0030.00316.24
7.3.290.0030.00516.20
7.3.280.0070.01016.35
7.3.270.0000.01717.40
7.3.260.0090.01216.68
7.3.250.0070.01116.46
7.3.240.0140.00316.44
7.3.230.0130.00316.63
7.3.210.0060.01016.46
7.3.200.0000.01819.39
7.3.190.0000.01716.59
7.3.180.0090.00816.51
7.3.170.0160.00716.50
7.3.160.0100.00616.38
7.3.130.0060.01015.00
7.3.120.0060.01214.66
7.3.110.0090.00314.76
7.3.100.0110.00315.00
7.3.90.0060.00914.73
7.3.80.0030.00615.05
7.3.70.0120.00314.59
7.3.60.0000.01714.68
7.3.50.0030.00614.93
7.3.40.0060.00614.90
7.3.30.0060.00314.75
7.3.20.0030.01016.73
7.3.10.0040.01416.73
7.3.00.0000.01216.41
7.2.330.0060.01316.29
7.2.320.0090.00916.65
7.2.310.0180.00016.69
7.2.300.0110.00716.30
7.2.290.0030.01316.70
7.2.260.0040.01515.20
7.2.250.0120.00314.96
7.2.240.0090.00615.16
7.2.230.0060.00915.09
7.2.220.0030.01014.90
7.2.210.0100.00314.86
7.2.200.0000.01615.16
7.2.190.0000.01515.07
7.2.180.0030.01014.86
7.2.170.0060.00614.81
7.2.160.0040.00414.91
7.2.150.0060.00616.82
7.2.140.0030.01417.04
7.2.130.0070.01016.53
7.2.120.0030.00916.63
7.2.110.0070.00316.86
7.2.100.0030.01216.80
7.2.90.0040.01117.04
7.2.80.0150.00016.72
7.2.70.0030.00616.73
7.2.60.0080.00716.86
7.2.50.0070.01116.86
7.2.40.0100.00316.50
7.2.30.0100.01016.69
7.2.20.0100.00616.56
7.2.10.0060.01216.76
7.2.00.0060.00818.18
7.1.330.0030.00615.80
7.1.320.0000.01415.98
7.1.310.0040.00715.91
7.1.300.0030.00615.91
7.1.290.0030.01015.80
7.1.280.0030.01015.76
7.1.270.0040.01115.72
7.1.260.0110.00415.81
7.1.250.0060.00615.82
7.1.240.0060.00915.80
7.1.230.0060.00615.62
7.1.220.0060.00615.70
7.1.210.0000.01115.81
7.1.200.0100.00615.79
7.1.190.0070.01015.50
7.1.180.0060.00615.62
7.1.170.0030.01315.39
7.1.160.0030.01015.88
7.1.150.0030.01315.73
7.1.140.0070.01115.57
7.1.130.0030.01015.80
7.1.120.0030.01015.75
7.1.110.0060.00815.94
7.1.100.0030.00916.89
7.1.90.0110.00415.61
7.1.80.0060.00615.80
7.1.70.0030.00816.22
7.1.60.0090.01117.49
7.1.50.0100.00316.33
7.1.40.0030.00715.53
7.1.30.0000.01115.59
7.1.20.0120.00015.83
7.1.10.0100.00315.59
7.1.00.0050.04319.02
7.0.330.0070.00415.25
7.0.320.0090.00315.38
7.0.310.0000.01015.39
7.0.300.0030.01015.25
7.0.290.0030.00915.24
7.0.280.0100.00715.37
7.0.270.0040.00815.38
7.0.260.0080.00515.55
7.0.250.0070.00715.49
7.0.240.0070.00715.39
7.0.230.0060.00615.55
7.0.220.0100.00015.32
7.0.210.0040.00715.42
7.0.200.0110.01116.18
7.0.190.0100.00315.21
7.0.180.0030.00815.42
7.0.170.0000.00915.20
7.0.160.0100.00315.25
7.0.150.0000.01015.39
7.0.140.0070.01015.29
7.0.130.0070.01015.53
7.0.120.0000.01315.48
7.0.110.0060.00615.38
7.0.100.0070.00315.26
7.0.90.0120.00315.33
7.0.80.0030.01315.18
7.0.70.0030.01015.27
7.0.60.0030.04018.51
7.0.50.0050.04816.73
7.0.40.0020.03016.91
7.0.30.0130.02516.77
7.0.20.0150.04716.88
7.0.10.0080.03916.85
7.0.00.0050.03016.70
5.6.400.0150.00014.64
5.6.390.0060.00314.14
5.6.380.0040.00414.48
5.6.370.0000.01014.07
5.6.360.0000.01414.54
5.6.350.0070.00414.55
5.6.340.0070.01013.97
5.6.330.0070.01014.30
5.6.320.0060.01014.25
5.6.310.0000.01514.25
5.6.300.0030.01314.38
5.6.290.0140.00413.90
5.6.280.0030.03217.63
5.6.270.0030.01014.26
5.6.260.0000.01314.18
5.6.250.0060.00614.58
5.6.240.0090.00614.24
5.6.230.0000.01414.45
5.6.220.0040.01114.46
5.6.210.0030.02817.48
5.6.200.0070.02816.33
5.6.190.0050.03217.25
5.6.180.0230.02517.51
5.6.170.0170.04017.28
5.6.160.0000.02717.36
5.6.150.0080.04316.27
5.6.140.0110.03816.35
5.6.130.0010.03916.17
5.6.120.0080.04517.73
5.6.110.0070.04517.58
5.6.100.0050.02317.64
5.6.90.0030.05017.67
5.6.80.0030.04517.21
5.6.70.0030.01014.00
5.6.60.0050.00313.91
5.6.50.0060.00914.13
5.6.40.0040.00714.10
5.6.30.0090.00014.06
5.6.20.0030.01414.32
5.6.10.0060.00614.49
5.6.00.0070.00714.11
5.5.380.0050.00514.25
5.5.370.0040.00714.23
5.5.360.0000.01014.35
5.5.350.0200.04017.28
5.5.340.0020.04516.03
5.5.330.0020.04717.30
5.5.320.0160.04317.27
5.5.310.0200.03817.43
5.5.300.0080.03316.11
5.5.290.0060.04016.11
5.5.280.0080.03517.64
5.5.270.0080.04517.56
5.5.260.0030.03617.50
5.5.250.0060.03417.37
5.5.240.0120.04017.18
5.5.230.0130.00314.14
5.5.220.0080.00314.32
5.5.210.0060.00614.27
5.5.200.0060.00914.02
5.5.190.0140.00014.00
5.5.180.0030.01214.09
5.5.170.0100.00314.25
5.5.160.0070.00714.19
5.5.150.0040.00814.01
5.5.140.0060.00313.99
5.5.130.0000.00914.02
5.5.120.0030.01014.21
5.5.110.0070.00714.00
5.5.100.0070.00714.33
5.5.90.0050.00514.40
5.5.80.0060.00614.26
5.5.70.0070.00714.38
5.5.60.0060.00914.23
5.5.50.0090.00314.00
5.5.40.0000.00813.96
5.5.30.0040.00413.94
5.5.20.0070.00714.02
5.5.10.0040.01114.20
5.5.00.0060.00314.39

preferences:
44.96 ms | 400 KiB | 5 Q