3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_flatten($array = null) { $result = array(); if (!is_array($array)) { $array = func_get_args(); } foreach ($array as $key => $value) { if (is_array($value)) { $result = array_merge($result, array_flatten($value)); } else { $result = array_merge($result, array($key => $value)); } } return $result; } $myarray = array('a', ['bla' => 0], 'b',[0,1], [0=>7], array(array(array('x'), 'y', 'z')), array(array('p'))); $res = array_flatten($myarray); var_dump( $res); $string_res = array_flatten( 'cramp' ); var_dump( $string_res );

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.70.0130.00616.63
8.3.60.0130.00616.75
8.3.50.0110.01118.07
8.3.40.0040.01118.76
8.3.30.0080.00818.71
8.3.20.0040.00420.77
8.3.10.0040.00421.41
8.3.00.0030.00619.25
8.2.190.0120.00318.26
8.2.180.0100.01016.50
8.2.170.0120.00322.96
8.2.160.0070.00721.18
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0030.00626.16
8.2.120.0040.00420.83
8.2.110.0040.00721.13
8.2.100.0080.00317.84
8.2.90.0030.00517.75
8.2.80.0080.00017.97
8.2.70.0040.00418.16
8.2.60.0070.00019.25
8.2.50.0040.00417.63
8.2.40.0030.00621.21
8.2.30.0040.00419.37
8.2.20.0050.00318.13
8.2.10.0060.00319.32
8.2.00.0000.00718.17
8.1.280.0060.01325.92
8.1.270.0000.00818.90
8.1.260.0110.00726.35
8.1.250.0040.00428.09
8.1.240.0060.00319.21
8.1.230.0120.00017.89
8.1.220.0040.00417.79
8.1.210.0080.00018.77
8.1.200.0030.00617.38
8.1.190.0040.00417.10
8.1.180.0030.00618.10
8.1.170.0060.00318.46
8.1.160.0070.00019.00
8.1.150.0000.00718.88
8.1.140.0050.00218.90
8.1.130.0000.00920.14
8.1.120.0040.00417.35
8.1.110.0040.00417.39
8.1.100.0000.00717.47
8.1.90.0040.00417.46
8.1.80.0020.00517.47
8.1.70.0070.00017.43
8.1.60.0000.00817.57
8.1.50.0040.00417.38
8.1.40.0030.00717.45
8.1.30.0000.00817.61
8.1.20.0060.00317.50
8.1.10.0000.00817.46
8.1.00.0040.00417.37
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0020.00518.55
8.0.270.0080.00018.52
8.0.260.0000.01018.46
8.0.250.0030.00316.84
8.0.240.0030.00316.91
8.0.230.0030.00316.86
8.0.220.0070.00016.86
8.0.210.0030.00316.87
8.0.200.0030.00316.95
8.0.190.0080.00016.98
8.0.180.0000.00816.81
8.0.170.0120.00016.88
8.0.160.0040.00417.00
8.0.150.0030.00516.69
8.0.140.0050.00216.91
8.0.130.0000.00513.31
8.0.120.0030.00516.76
8.0.110.0000.00716.89
8.0.100.0030.00516.76
8.0.90.0070.00016.93
8.0.80.0060.01016.84
8.0.70.0000.00716.88
8.0.60.0000.00716.88
8.0.50.0040.00416.70
8.0.30.0120.00517.00
8.0.20.0070.01216.89
8.0.10.0040.01116.96
8.0.00.0080.00916.80
7.4.330.0000.00515.55
7.4.320.0030.00316.44
7.4.300.0000.00716.58
7.4.290.0020.00516.62
7.4.280.0070.00416.52
7.4.270.0000.00716.63
7.4.260.0030.00316.61
7.4.250.0040.00416.48
7.4.240.0000.00716.40
7.4.230.0030.00316.39
7.4.220.0040.00416.45
7.4.210.0080.00816.52
7.4.200.0040.00416.63
7.4.160.0000.01616.70
7.4.150.0130.00916.59
7.4.140.0060.01217.38
7.4.130.0090.00916.47
7.4.120.0120.00816.51
7.4.110.0100.00716.50
7.4.100.0130.01016.51
7.4.90.0120.00816.43
7.4.80.0110.00917.49
7.4.70.0100.00916.50
7.4.60.0120.00416.44
7.4.50.0100.01116.30
7.4.40.0120.00716.39
7.4.30.0090.00916.45
7.4.20.0080.01116.47
7.4.10.0130.00316.45
7.4.00.0030.01515.50
7.3.330.0000.00513.38
7.3.320.0000.00513.37
7.3.310.0080.00016.38
7.3.300.0030.00316.38
7.3.290.0030.00316.38
7.3.280.0000.02216.44
7.3.270.0000.01416.40
7.3.260.0080.00916.41
7.3.250.0080.01116.37
7.3.240.0070.01216.36
7.3.230.0100.01016.49
7.3.220.0150.00516.45
7.3.210.0120.00716.40
7.3.200.0080.01316.35
7.3.190.0070.01016.46
7.3.180.0050.01216.44
7.3.170.0120.01016.46
7.3.160.0080.01016.39
7.3.150.0100.00916.43
7.3.140.0100.00716.30
7.3.130.0090.00816.38
7.3.120.0110.00715.61
7.3.110.0110.00515.59
7.3.100.0070.00815.56
7.3.90.0050.01015.66
7.3.80.0100.00715.61
7.3.70.0060.01015.59
7.3.60.0090.00615.62
7.3.50.0090.00515.36
7.3.40.0080.00815.33
7.3.30.0090.00715.22
7.3.20.0110.00516.54
7.3.10.0250.00716.12
7.3.00.0170.00516.32
7.2.340.0150.00516.47
7.2.330.0100.01016.57
7.2.320.0110.00716.49
7.2.310.0090.01116.46
7.2.300.0110.01116.45
7.2.290.0100.00816.59
7.2.280.0080.01216.52
7.2.270.0110.00916.50
7.2.260.0080.01016.64
7.2.250.0070.01215.64
7.2.240.0090.00615.74
7.2.230.0120.00615.79
7.2.220.0090.00815.65
7.2.210.0060.01115.74
7.2.200.0070.00915.84
7.2.190.0090.00915.85
7.2.180.0080.00915.52
7.2.170.0070.00915.48
7.2.160.0080.01115.71
7.2.150.0110.00716.76
7.2.140.0100.01116.84
7.2.130.0420.00816.55
7.2.120.0310.01016.49
7.2.110.0370.00516.52
7.2.100.0180.01216.35
7.2.90.0240.00816.53
7.2.80.0210.00816.44
7.2.70.0220.00616.42
7.2.60.0220.00616.54
7.2.50.0170.00716.47
7.2.40.0170.00616.49
7.2.30.0150.01016.46
7.2.20.0160.00716.12
7.2.10.0150.01016.25
7.2.00.0150.00716.19
7.1.330.0130.00616.15
7.1.320.0100.00916.20
7.1.310.0080.01116.10
7.1.300.0090.01116.14
7.1.290.0140.00516.09
7.1.280.0100.00715.63
7.1.270.0120.00715.60
7.1.260.0100.00915.67
7.1.250.0200.00515.33
7.1.240.0350.00915.13
7.1.230.0170.00515.64
7.1.220.0160.00715.59
7.1.210.0170.00615.60
7.1.200.0150.01115.56
7.1.190.0120.01115.53
7.1.180.0170.00815.53
7.1.170.0150.00815.60
7.1.160.0130.01015.65
7.1.150.0160.00715.61
7.1.140.0150.00815.13
7.1.130.0190.00515.18
7.1.120.0180.00715.19
7.1.110.0310.00915.25
7.1.100.0170.00715.20
7.1.90.0110.01215.21
7.1.80.0150.00615.36
7.1.70.0170.00715.17
7.1.60.0160.00915.26
7.1.50.0170.00715.18
7.1.40.0170.00815.13
7.1.30.0140.00715.19
7.1.20.0170.00515.10
7.1.10.0170.00515.22
7.1.00.0150.00815.21

preferences:
69.34 ms | 401 KiB | 5 Q