3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = ['foo' => ['bar' => 'lol', 'asdf' => ['rofl', ['haha' => 'lmao'], 'lawl']], ['hehe' => 'haha']]; function getLeafsWithKeys(array $array, array $keys = []): array { $result = []; foreach ($array as $key => $value) { $new_keys = is_numeric($key) ? $keys : array_merge($keys, [$key]); if (is_array($value)) { $result = array_merge([], ...[$result, getLeafsWithKeys($value, $new_keys)]); } else { $result[implode(' > ', $new_keys)][] = $value; } } return $result; } print_r(getLeafsWithKeys($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.4.130.0090.00617.48
8.4.120.0160.00822.22
8.4.110.0120.00922.50
8.4.100.0110.00917.73
8.4.90.0100.00918.93
8.4.80.0100.01017.79
8.4.70.0060.00617.74
8.4.60.0080.01318.66
8.4.50.0130.00718.41
8.4.40.0070.01319.38
8.4.30.0090.00020.37
8.4.20.0030.00719.01
8.4.10.0040.00417.50
8.3.260.0090.00916.50
8.3.250.0120.00718.79
8.3.240.0130.00616.61
8.3.230.0120.00816.51
8.3.220.0090.00917.18
8.3.210.0120.00616.85
8.3.200.0040.00516.48
8.3.190.0100.01217.22
8.3.180.0080.01116.53
8.3.170.0110.00919.00
8.3.160.0060.00317.26
8.3.150.0110.01117.29
8.3.140.0140.00418.98
8.3.130.0000.00818.40
8.3.120.0030.00620.78
8.3.110.0120.00620.94
8.3.100.0070.00424.06
8.3.90.0080.00026.77
8.3.80.0070.00318.56
8.3.70.0150.00016.59
8.3.60.0100.00618.43
8.3.50.0080.00624.46
8.3.40.0030.01318.87
8.3.30.0040.01118.84
8.3.20.0030.00622.35
8.3.10.0000.00821.85
8.3.00.0040.00420.66
8.2.290.0130.00720.23
8.2.280.0140.00518.48
8.2.270.0080.00019.00
8.2.260.0080.00816.68
8.2.250.0060.00316.90
8.2.240.0090.00617.25
8.2.230.0100.00022.58
8.2.220.0060.00337.54
8.2.210.0090.00926.77
8.2.200.0040.00418.25
8.2.190.0100.01016.58
8.2.180.0120.00918.29
8.2.170.0000.01522.96
8.2.160.0070.00720.57
8.2.150.0090.00024.18
8.2.140.0050.00224.66
8.2.130.0070.00026.16
8.2.120.0060.00326.16
8.2.110.0060.00320.52
8.2.100.0130.00318.22
8.2.90.0050.00318.03
8.2.80.0040.00418.05
8.2.70.0060.00318.16
8.2.60.0000.00818.16
8.2.50.0070.00318.10
8.2.40.0080.00021.21
8.2.30.0000.00719.25
8.2.20.0050.00318.16
8.2.10.0000.00718.94
8.2.00.0040.00419.20
8.1.330.0140.00522.25
8.1.320.0090.01016.06
8.1.310.0120.00318.46
8.1.300.0090.00616.44
8.1.290.0000.01018.88
8.1.280.0080.00825.92
8.1.270.0040.00422.42
8.1.260.0000.00726.35
8.1.250.0080.00028.09
8.1.240.0000.00820.94
8.1.230.0000.01120.91
8.1.220.0040.00417.74
8.1.210.0060.00318.79
8.1.200.0060.00317.47
8.1.190.0030.00617.35
8.1.180.0030.00618.10
8.1.170.0050.00318.59
8.1.160.0000.00720.19
8.1.150.0040.00418.81
8.1.140.0070.00018.91
8.1.130.0000.00720.21
8.1.120.0000.00717.41
8.1.110.0040.00417.33
8.1.100.0030.00317.36
8.1.90.0090.00317.50
8.1.80.0040.00417.48
8.1.70.0070.00317.39
8.1.60.0040.00417.61
8.1.50.0000.00717.46
8.1.40.0050.00317.42
8.1.30.0050.00517.75
8.1.20.0040.00417.68
8.1.10.0040.00417.60
8.1.00.0090.00317.36
8.0.300.0080.00021.41
8.0.290.0080.00016.75
8.0.280.0000.00818.51
8.0.270.0030.00616.75
8.0.260.0000.00720.08
8.0.250.0070.00016.98
8.0.240.0040.00416.97
8.0.230.0050.00316.99
8.0.220.0030.00316.80
8.0.210.0000.00816.88
8.0.200.0000.00716.86
8.0.190.0030.00416.86
8.0.180.0000.00716.94
8.0.170.0040.00416.91
8.0.160.0050.00316.98
8.0.150.0030.00516.93
8.0.140.0000.00816.88
8.0.130.0070.00013.30
8.0.120.0060.00316.91
8.0.110.0070.00016.96
8.0.100.0040.00417.02
8.0.90.0060.00316.80
8.0.80.0150.00416.91
8.0.70.0040.00416.74
8.0.60.0050.00316.86
8.0.50.0040.00416.97
8.0.30.0130.00417.20
8.0.20.0180.00717.02
8.0.10.0040.00417.10
8.0.00.0150.00916.55
7.4.330.0000.00515.55
7.4.320.0050.00216.57
7.4.300.0000.00616.50
7.4.290.0030.00516.46
7.4.280.0080.00016.61
7.4.270.0000.00716.48
7.4.260.0000.00613.41
7.4.250.0000.00716.63
7.4.240.0050.00216.65
7.4.230.0030.00316.41
7.4.220.0030.00416.67
7.4.210.0130.00016.53
7.4.200.0030.00316.65
7.4.130.0120.00616.57
7.4.120.0120.00916.53
7.4.110.0100.00816.57
7.4.100.0130.00616.56
7.4.90.0090.00916.32
7.4.80.0130.00419.39
7.4.70.0030.01316.45
7.4.60.0060.00916.45
7.4.50.0060.00916.27
7.4.40.0100.01016.38
7.4.00.0080.00814.76
7.3.330.0040.00416.36
7.3.320.0000.00613.30
7.3.310.0030.00316.39
7.3.300.0020.00516.41
7.3.290.0060.01016.40
7.3.280.0060.01216.43
7.3.260.0080.01216.38
7.3.230.0070.01016.42
7.3.210.0100.00716.44
7.3.200.0070.01016.52
7.3.190.0070.01016.61
7.3.180.0060.01016.39
7.3.170.0160.00516.54
7.3.160.0100.00716.46
7.3.120.0070.01314.76
7.3.110.0040.01114.87
7.3.100.0070.00714.69
7.3.90.0090.00714.91
7.3.80.0050.00914.72
7.3.70.0000.01514.66
7.3.60.0110.00714.63
7.3.50.0130.00514.66
7.3.40.0100.01014.81
7.3.30.0080.00814.49
7.3.20.0130.00715.86
7.3.10.0110.00615.78
7.3.00.0060.00715.62
7.2.330.0030.01316.44
7.2.320.0110.01116.57
7.2.310.0140.00416.83
7.2.300.0100.01016.86
7.2.290.0160.00616.79
7.2.250.0100.00614.92
7.2.240.0100.00715.05
7.2.230.0100.00714.92
7.2.220.0080.00815.02
7.2.210.0040.01114.75
7.2.200.0090.00914.76
7.2.190.0070.01215.15
7.2.180.0090.00814.93
7.2.170.0090.00714.92
7.2.160.0170.00615.05
7.2.150.0190.00014.97
7.2.140.0100.01014.73
7.2.130.0120.01515.19
7.2.120.0170.00714.79
7.2.110.0170.01015.03
7.2.100.0190.00815.03
7.2.90.0220.01015.06
7.2.80.0210.01014.69
7.2.70.0150.01114.66
7.2.60.0270.00915.09
7.2.50.0130.01214.98
7.2.40.0130.01515.13
7.2.30.0120.01914.90
7.2.20.0140.01414.93
7.2.10.0150.00914.96
7.2.00.0190.00315.09
7.1.330.0120.00514.75
7.1.320.0040.01114.94
7.1.310.0100.00614.56
7.1.300.0100.00814.82
7.1.290.0110.00714.85
7.1.280.0070.01414.83
7.1.270.0110.00714.63
7.1.260.0100.00514.83
7.1.250.0070.02113.79

preferences:
27.81 ms | 403 KiB | 5 Q