3v4l.org

run code in 300+ PHP versions simultaneously
<?php $testArray= [ 'test1' => 'SingleValue1', 'test2' => 'SingleValue2' ]; function deepestArrays(array $array, int $level = 0, array &$lowest = []): array { $subarrays = array_filter($array, 'is_array'); if ($subarrays) { // a deeper level exists foreach ($subarrays as $subarray) { deepestArrays($subarray, $level + 1, $lowest); // recurse each subarray } } else { // deepest level in branch $lowestLevel = key($lowest) ?? $level; // if lowest array is empty, key will be null, fallback to $level value if ($lowestLevel === $level) { $lowest[$level][] = $array; // push the array into the results } elseif ($lowestLevel < $level) { $lowest = [$level => [$array]]; // overwrite with new lowest array } } return current($lowest); // return the deepest array } var_export( deepestArrays($testArray) );

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.0130.00718.93
8.4.120.0130.00619.63
8.4.110.0100.00922.29
8.4.100.0130.00717.97
8.4.90.0140.00620.56
8.4.80.0140.00718.73
8.4.70.0070.00220.59
8.4.60.0090.00720.22
8.4.50.0080.00020.57
8.4.40.0040.01517.85
8.4.30.0110.00420.82
8.4.20.0150.00424.04
8.4.10.0080.00021.27
8.3.260.0100.00616.73
8.3.250.0130.00716.60
8.3.240.0140.00516.76
8.3.230.0050.00416.70
8.3.220.0060.01218.86
8.3.210.0110.00916.82
8.3.200.0060.00316.39
8.3.190.0110.01317.05
8.3.180.0090.01019.01
8.3.170.0070.01117.14
8.3.160.0130.00618.29
8.3.150.0110.00718.44
8.3.140.0110.00818.62
8.3.130.0190.00018.14
8.3.120.0040.01118.88
8.3.110.0050.00320.94
8.3.100.0030.00624.06
8.3.90.0000.00726.77
8.3.80.0000.01116.75
8.3.70.0150.00616.61
8.3.60.0140.00416.50
8.3.50.0070.01123.58
8.3.40.0090.01220.38
8.3.30.0040.01118.89
8.3.20.0070.00024.18
8.3.10.0080.00024.66
8.3.00.0070.00026.16
8.2.290.0120.00416.72
8.2.280.0100.00918.64
8.2.270.0160.00618.24
8.2.260.0040.01116.88
8.2.250.0120.00618.35
8.2.240.0070.01117.27
8.2.230.0040.00422.58
8.2.220.0090.00037.54
8.2.210.0000.00826.77
8.2.200.0090.00016.50
8.2.190.0100.01016.63
8.2.180.0110.00425.92
8.2.170.0090.00618.97
8.2.160.0080.00622.96
8.2.150.0050.00325.66
8.2.140.0070.00024.66
8.2.130.0040.00426.16
8.2.120.0070.01120.89
8.2.110.0160.00321.18
8.2.100.0090.00317.78
8.2.90.0050.00317.91
8.2.80.0090.00019.89
8.2.70.0040.00417.63
8.2.60.0050.00317.63
8.2.50.0040.00417.55
8.2.40.0000.00718.22
8.2.30.0040.00418.11
8.2.20.0040.00417.99
8.2.10.0040.00419.27
8.2.00.0060.00319.12
8.1.330.0130.00716.25
8.1.320.0120.00716.15
8.1.310.0000.00716.67
8.1.300.0040.00418.12
8.1.290.0060.00318.88
8.1.280.0130.00325.92
8.1.270.0120.00323.99
8.1.260.0130.00726.35
8.1.250.0100.00328.09
8.1.240.0060.00320.89
8.1.230.0060.00622.17
8.1.220.0050.00317.74
8.1.210.0030.00518.77
8.1.200.0000.00817.23
8.1.190.0000.00817.13
8.1.180.0030.00518.10
8.1.170.0030.00518.63
8.1.160.0040.00418.75
8.1.150.0000.00818.86
8.1.140.0040.00418.82
8.1.130.0080.00020.17
8.1.120.0030.00317.35
8.1.110.0040.00417.44
8.1.100.0070.00017.46
8.1.90.0040.00417.30
8.1.80.0040.00417.43
8.1.70.0040.00417.33
8.1.60.0000.00817.57
8.1.50.0080.00017.43
8.1.40.0000.00817.53
8.1.30.0030.00617.57
8.1.20.0040.00417.61
8.1.10.0000.00817.51
8.1.00.0040.00417.39
8.0.300.0060.00319.98
8.0.290.0030.00616.75
8.0.280.0030.00318.36
8.0.270.0030.00317.97
8.0.260.0030.00318.39
8.0.250.0030.00316.86
8.0.240.0070.00016.94
8.0.230.0070.00016.89
8.0.220.0030.00316.87
8.0.210.0070.00016.75
8.0.200.0040.00416.92
8.0.190.0000.00816.91
8.0.180.0040.00416.79
8.0.170.0030.00616.74
8.0.160.0000.00716.77
8.0.150.0060.00316.76
8.0.140.0040.00416.70
8.0.130.0030.00313.21
8.0.120.0030.00516.76
8.0.110.0040.00416.67
8.0.100.0000.00716.79
8.0.90.0000.00816.90
8.0.80.0050.01116.81
8.0.70.0040.00416.91
8.0.60.0040.00416.88
8.0.50.0050.00216.74
8.0.30.0070.01016.83
8.0.20.0120.00616.98
8.0.10.0000.00716.98
8.0.00.0140.01116.69
7.4.330.0050.00015.55
7.4.320.0000.00716.57
7.4.300.0000.00616.63
7.4.290.0050.00216.63
7.4.280.0000.01016.60
7.4.270.0000.00716.46
7.4.260.0030.00313.35
7.4.250.0000.00716.57
7.4.240.0030.00616.44
7.4.230.0030.00316.39
7.4.220.0030.00316.64
7.4.210.0090.00816.54
7.4.200.0030.00316.33
7.4.130.0100.01116.48
7.4.120.0070.01416.62
7.4.110.0170.00016.58
7.4.100.0140.00716.43
7.4.90.0040.01816.35
7.4.80.0100.01316.72
7.4.70.0070.01716.48
7.4.60.0100.01316.62
7.4.50.0150.00916.58
7.4.40.0120.00916.46
7.4.30.0160.00816.12
7.4.20.0150.00716.36
7.4.10.0110.01416.55
7.4.00.0090.01316.55
7.3.330.0030.00316.29
7.3.320.0030.00313.42
7.3.310.0070.00016.29
7.3.300.0000.00716.28
7.3.290.0080.00916.35
7.3.260.0140.01016.72
7.3.230.0120.00616.65
7.3.220.0120.00616.31
7.3.210.0140.00616.50
7.3.200.0000.02416.68
7.3.190.0060.01616.52
7.3.180.0160.00916.43
7.3.170.0120.01216.30
7.3.160.0140.00716.34
7.3.150.0060.01816.21
7.3.140.0100.01016.35
7.3.130.0180.00616.43
7.3.120.0170.00316.52
7.3.110.0200.00516.41
7.3.100.0200.00316.45
7.3.90.0090.01316.24
7.3.80.0130.00716.58
7.3.70.0100.01316.29
7.3.60.0070.01616.29
7.3.50.0070.01416.33
7.3.40.0120.00616.41
7.3.30.0130.01016.30
7.3.20.0040.02116.23
7.3.10.0160.00415.97
7.3.00.0090.01016.47
7.2.330.0150.00416.76
7.2.320.0070.01716.80
7.2.310.0180.00616.71
7.2.300.0140.00716.40
7.2.290.0090.01216.63
7.2.280.0130.00916.35
7.2.270.0120.00916.76
7.2.260.0070.01716.54
7.2.250.0180.00616.27
7.2.240.0170.00616.44
7.2.230.0150.00616.43
7.2.220.0130.00816.32
7.2.210.0080.01616.47
7.2.200.0060.01316.31
7.2.190.0190.00516.39
7.2.180.0130.01016.45
7.2.170.0100.01216.39
7.2.160.0130.00616.39
7.2.150.0090.01516.50
7.2.140.0130.01016.56
7.2.130.0120.01216.48
7.2.120.0240.01516.46
7.2.110.0120.00816.48
7.2.100.0200.00616.68
7.2.90.0100.01416.65
7.2.80.0120.01216.61
7.2.70.0060.01616.41
7.2.60.0060.01916.32
7.2.50.0090.01416.34
7.2.40.0070.01316.50
7.2.30.0090.01316.58
7.2.20.0160.01016.51
7.2.10.0140.00716.59
7.2.00.0150.00716.65

preferences:
114.98 ms | 403 KiB | 5 Q