3v4l.org

run code in 300+ PHP versions simultaneously
<?php function flatten($arr) { $result = []; foreach ($arr as $key => $value) { if (is_array($value)) { foreach (flatten($value) as $subKey => $scalar) { $result[$key . ':' . $subKey] = $scalar; } } else if (is_scalar($value)) { $result[$key] = $value; } } return $result; } var_dump(flatten(['foo' => 123, 'bar' => 456])); var_dump(flatten(['foo' => ['bar' => 123, 'baz' => 456]]));

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.0200.00016.50
8.3.50.0140.00522.10
8.3.40.0100.00718.67
8.3.30.0040.01119.04
8.3.20.0000.00820.39
8.3.10.0080.00023.48
8.3.00.0040.00422.58
8.2.180.0060.00916.75
8.2.170.0070.00722.96
8.2.160.0070.00722.16
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0040.00422.08
8.2.110.0090.00019.27
8.2.100.0080.00417.84
8.2.90.0050.00319.27
8.2.80.0000.00817.97
8.2.70.0060.00317.63
8.2.60.0090.00018.04
8.2.50.0080.00018.07
8.2.40.0000.00920.07
8.2.30.0050.00218.11
8.2.20.0040.00417.68
8.2.10.0040.00417.66
8.2.00.0030.00617.64
8.1.280.0140.00025.92
8.1.270.0030.00523.87
8.1.260.0000.00826.35
8.1.250.0070.00028.09
8.1.240.0060.00322.10
8.1.230.0090.00320.65
8.1.220.0050.00317.77
8.1.210.0050.00318.77
8.1.200.0030.00617.35
8.1.190.0040.00417.53
8.1.180.0040.00418.10
8.1.170.0040.00418.63
8.1.160.0000.00821.95
8.1.150.0040.00418.51
8.1.140.0080.00017.55
8.1.130.0000.00717.74
8.1.120.0000.00717.29
8.1.110.0020.00517.37
8.1.100.0000.00717.47
8.1.90.0000.00917.47
8.1.80.0070.00017.46
8.1.70.0030.00317.41
8.1.60.0030.00617.51
8.1.50.0050.00317.47
8.1.40.0000.00817.41
8.1.30.0040.00417.60
8.1.20.0040.00417.63
8.1.10.0040.00417.48
8.1.00.0040.00417.40
8.0.300.0080.00018.77
8.0.290.0060.00316.75
8.0.280.0030.00318.41
8.0.270.0040.00417.32
8.0.260.0030.00316.77
8.0.250.0030.00316.85
8.0.240.0040.00317.00
8.0.230.0000.00716.97
8.0.220.0000.00716.91
8.0.210.0000.00916.91
8.0.200.0030.00316.96
8.0.190.0000.00716.94
8.0.180.0040.00416.97
8.0.170.0030.00516.98
8.0.160.0050.00316.86
8.0.150.0000.00716.91
8.0.140.0030.00516.87
8.0.130.0000.00513.41
8.0.120.0060.00316.95
8.0.110.0000.00816.77
8.0.100.0040.00416.79
8.0.90.0040.00416.79
8.0.80.0080.00716.89
8.0.70.0040.00416.78
8.0.60.0000.00716.96
8.0.50.0070.00016.82
8.0.30.0150.00317.07
8.0.20.0050.01417.40
8.0.10.0040.00417.12
8.0.00.0080.01216.70
7.4.330.0050.00015.00
7.4.320.0030.00316.49
7.4.300.0060.00016.44
7.4.290.0000.00716.48
7.4.280.0070.00016.58
7.4.270.0000.00816.45
7.4.260.0030.00316.45
7.4.250.0070.00016.45
7.4.240.0030.00416.53
7.4.230.0070.00016.53
7.4.220.0100.01016.52
7.4.210.0060.00916.55
7.4.200.0040.00416.52
7.4.190.0000.00716.30
7.4.160.0060.00916.60
7.4.150.0090.00917.40
7.4.140.0130.01117.86
7.4.130.0110.00716.59
7.4.120.0130.00516.35
7.4.110.0150.00716.61
7.4.100.0150.00416.52
7.4.90.0140.00416.50
7.4.80.0090.00919.39
7.4.70.0180.00016.50
7.4.60.0060.00916.55
7.4.50.0040.00416.35
7.4.40.0090.00622.77
7.4.30.0100.00716.63
7.4.00.0080.01115.07
7.3.330.0000.00613.18
7.3.320.0000.00513.12
7.3.310.0000.00716.21
7.3.300.0000.00716.28
7.3.290.0040.01516.34
7.3.280.0110.00516.34
7.3.270.0080.00817.40
7.3.260.0130.00416.40
7.3.250.0140.00516.44
7.3.240.0170.00016.42
7.3.230.0070.01016.45
7.3.210.0130.00716.50
7.3.200.0130.01019.39
7.3.190.0040.01316.36
7.3.180.0120.00916.48
7.3.170.0040.01316.48
7.3.160.0080.00816.41
7.3.120.0070.01014.69
7.3.110.0030.01615.07
7.3.100.0060.00914.84
7.3.90.0060.00914.75
7.3.80.0000.01114.70
7.3.70.0040.01514.96
7.3.60.0030.00614.86
7.3.50.0070.01014.62
7.3.40.0070.01014.92
7.3.30.0030.01214.62
7.3.20.0030.01116.41
7.3.10.0030.01016.43
7.3.00.0000.01316.54
7.2.330.0140.00316.52
7.2.320.0150.00916.40
7.2.310.0110.00516.60
7.2.300.0060.01116.65
7.2.290.0090.00816.65
7.2.250.0030.01615.10
7.2.240.0030.01615.00
7.2.230.0030.01615.09
7.2.220.0000.01315.05
7.2.210.0030.01215.07
7.2.200.0100.00314.88
7.2.190.0060.00914.83
7.2.180.0110.00415.08
7.2.170.0040.00414.90
7.2.60.0040.01116.82
7.1.330.0060.01015.87
7.1.320.0040.01115.55
7.1.310.0030.01315.69
7.1.300.0000.01415.72
7.1.290.0030.01216.03
7.1.280.0090.00616.05
7.1.270.0060.00615.88
7.1.260.0030.00615.57
7.1.200.0040.00415.90
7.1.70.0040.00417.09
7.1.60.0140.01019.29
7.1.50.0080.01216.77
7.1.00.0000.08022.44
7.0.200.0040.00716.69
7.0.140.0070.07022.11
7.0.60.0100.08020.02
7.0.50.0070.08317.79
7.0.40.0070.08720.30
7.0.30.0300.03720.27
7.0.20.0230.08020.33
7.0.10.0330.05320.16
7.0.00.0030.05720.29
5.6.280.0030.07320.79
5.6.210.0200.07320.66
5.6.200.0030.04018.15
5.6.190.0100.04720.68
5.6.180.0200.04020.75
5.6.170.0230.04320.51
5.6.160.0070.08320.71
5.6.150.0170.05718.17
5.6.140.0070.08018.15
5.6.130.0100.08318.28
5.6.120.0100.06721.02
5.6.110.0300.06020.99
5.6.100.0030.06320.96
5.6.90.0030.08721.04
5.6.80.0230.06720.44
5.6.70.3700.03020.40
5.5.350.0130.04020.33
5.5.340.0070.07718.02
5.5.330.0030.04320.27
5.5.320.0070.06720.46
5.5.310.0100.04720.27
5.5.300.0100.03717.98
5.5.290.0000.04717.95
5.5.280.0070.08020.80
5.5.270.0070.05320.73
5.5.260.0030.08320.65
5.5.250.0070.07720.47
5.5.240.0030.04020.34
5.4.450.0830.05719.70
5.4.440.0570.06019.63
5.4.430.0870.04019.63
5.4.420.0070.06019.38
5.4.410.0230.05718.71
5.4.400.0100.06018.51
5.4.390.0130.05018.56
5.4.380.0170.06318.53
5.4.370.0130.05318.74
5.4.360.0230.06718.73
5.4.350.0200.05018.61
5.4.340.0200.06018.50
5.4.320.0060.04312.51
5.4.310.0060.04312.50
5.4.300.0090.04012.50
5.4.290.0080.04112.50
5.4.280.0290.08712.38
5.4.270.0110.04712.37
5.4.260.0160.08112.37
5.4.250.0090.06612.37
5.4.240.0130.07012.37
5.4.230.0070.05412.37
5.4.220.0130.03612.36
5.4.210.0030.04112.36
5.4.200.0050.04312.36
5.4.190.0070.03812.36
5.4.180.0040.04112.36
5.4.170.0080.04312.37
5.4.160.0180.07412.37
5.4.150.0120.03312.36
5.4.140.0080.04312.04
5.4.130.0050.04112.03
5.4.120.0100.08011.99
5.4.110.0070.03711.99
5.4.100.0070.03911.99
5.4.90.0060.04311.98
5.4.80.0100.03811.99
5.4.70.0240.08511.98
5.4.60.0090.03411.98
5.4.50.0110.05311.98
5.4.40.0100.04011.96
5.4.30.0100.03511.96
5.4.20.0080.05011.96
5.4.10.0070.04611.97
5.4.00.0050.05011.45
5.3.290.0070.05212.80
5.3.280.0310.10412.71
5.3.270.0070.04112.73
5.3.260.0080.03812.72
5.3.250.0090.04612.72
5.3.240.0110.04112.72
5.3.230.0080.06012.71
5.3.220.0210.07412.68
5.3.210.0100.05812.68
5.3.200.0120.07912.68
5.3.190.0110.08212.68
5.3.180.0130.05412.67
5.3.170.0080.05812.67
5.3.160.0090.05712.67
5.3.150.0110.05612.68
5.3.140.0040.06312.66
5.3.130.0090.08312.66
5.3.120.0180.07912.66
5.3.110.0100.08312.66
5.3.100.0060.07412.12
5.3.90.0110.05412.08
5.3.80.0110.04012.07
5.3.70.0080.05512.07
5.3.60.0050.04212.07
5.3.50.0070.03712.00
5.3.40.0050.04312.00
5.3.30.0040.04411.95
5.3.20.0090.03311.74
5.3.10.0060.03811.70
5.3.00.0110.04811.69
5.2.170.0080.0569.18
5.2.160.0060.0349.18
5.2.150.0070.0319.18
5.2.140.0070.0299.18
5.2.130.0090.0459.14
5.2.120.0160.0559.14
5.2.110.0140.0519.15
5.2.100.0060.0429.14
5.2.90.0090.0569.14
5.2.80.0170.0539.14
5.2.70.0130.0329.14
5.2.60.0070.0389.09
5.2.50.0080.0399.05
5.2.40.0060.0419.04
5.2.30.0090.0389.01
5.2.20.0070.0399.00
5.2.10.0080.0318.92
5.2.00.0080.0368.78
5.1.60.0030.0368.06
5.1.50.0070.0318.06
5.1.40.0140.0378.04
5.1.30.0080.0378.39
5.1.20.0080.0448.42
5.1.10.0080.0388.14
5.1.00.0050.0388.14
5.0.50.0060.0576.61
5.0.40.0080.0396.48
5.0.30.0060.0396.29
5.0.20.0040.0266.26
5.0.10.0040.0276.23
5.0.00.0060.0316.22
4.4.90.0040.0154.78
4.4.80.0040.0164.76
4.4.70.0040.0204.75
4.4.60.0020.0234.76
4.4.50.0030.0234.77
4.4.40.0040.0464.71
4.4.30.0100.0264.75
4.4.20.0070.0204.84
4.4.10.0050.0264.85
4.4.00.0040.0344.76
4.3.110.0040.0214.67
4.3.100.0040.0194.67
4.3.90.0040.0164.64
4.3.80.0040.0304.58
4.3.70.0040.0234.63
4.3.60.0050.0164.63
4.3.50.0060.0204.63
4.3.40.0070.0254.54
4.3.30.0020.0223.28
4.3.20.0060.0203.27
4.3.10.0040.0173.23
4.3.00.0170.01313.64

preferences:
52.51 ms | 400 KiB | 5 Q