3v4l.org

run code in 300+ PHP versions simultaneously
<?php function pathToNestedArray($path, $separator = "/") { // use DIRECTORY_SEPARATOR for greater utility $halves = explode($separator, $path, 2); // maximum explosion is 2 elements if (!isset($halves[1])) return [$path]; // no folder to nest into, append as indexed element (Done) return [$halves[0] => pathToNestedArray($halves[1])]; // apply level's key value and recurse } $paths = [ "fileZ.php", "folder1/content/file1.php", "folder1/content/file2.php", "folder1/edit/file1.php", "folder1/edit/file2.php", "folder1/pagination/file1.php", "folder1/pagination/file2.php", "folder1/toolbar/file1.php", "folder1/toolbar/file2.php", "folder2/cms/html/file1.php", "folder2/cms/html/file2.php" ]; $result = []; foreach ($paths as $path) { $result = array_merge_recursive($result, pathToNestedArray($path)); } var_export($result);

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.140.0150.00617.55
8.4.130.0130.00718.66
8.4.120.0070.00123.98
8.4.110.0070.00218.98
8.4.100.0150.00617.69
8.4.90.0130.01018.60
8.4.80.0110.00919.51
8.4.70.0150.00517.94
8.4.60.0080.01418.87
8.4.50.0150.00617.83
8.4.40.0130.00617.59
8.4.30.0160.00317.72
8.4.20.0040.01819.47
8.4.10.0030.00517.84
8.3.270.0160.00416.52
8.3.260.0110.00816.53
8.3.250.0100.00818.86
8.3.240.0030.00517.34
8.3.230.0040.00616.63
8.3.220.0090.00617.08
8.3.210.0110.00916.49
8.3.200.0130.00716.68
8.3.190.0090.00617.13
8.3.180.0100.00916.92
8.3.170.0120.00616.73
8.3.160.0110.00716.67
8.3.150.0130.00617.22
8.3.140.0100.00016.51
8.3.130.0100.01018.53
8.3.120.0120.00320.76
8.3.110.0060.00320.94
8.3.100.0100.01024.06
8.3.90.0120.00626.77
8.3.80.0090.00018.11
8.3.70.0060.01316.38
8.3.60.0090.00616.62
8.3.50.0100.00718.19
8.3.40.0160.00018.97
8.3.30.0150.00018.47
8.3.20.0040.00421.79
8.3.10.0060.00321.95
8.3.00.0070.00021.86
8.2.290.0120.00720.83
8.2.280.0110.00918.38
8.2.270.0100.01016.88
8.2.260.0110.00719.10
8.2.250.0140.00716.89
8.2.240.0080.00817.06
8.2.230.0100.01022.58
8.2.220.0080.00037.54
8.2.210.0050.00326.77
8.2.200.0080.00316.50
8.2.190.0110.00716.75
8.2.180.0150.00618.53
8.2.170.0070.01022.96
8.2.160.0140.00020.47
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0040.00420.94
8.2.120.0040.00426.35
8.2.110.0090.00320.98
8.2.100.0230.00317.46
8.2.90.0000.00918.09
8.2.80.0000.00817.97
8.2.70.0000.00818.03
8.2.60.0080.00017.93
8.2.50.0080.00018.16
8.2.40.0040.00420.54
8.2.30.0030.00719.63
8.2.20.0050.00318.05
8.2.10.0030.00618.05
8.2.00.0040.00418.13
8.1.330.0070.00422.03
8.1.320.0080.01116.00
8.1.310.0040.00418.53
8.1.300.0090.00017.84
8.1.290.0000.00830.84
8.1.280.0110.00425.92
8.1.270.0040.00423.71
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0160.00622.19
8.1.230.0080.00420.76
8.1.220.0000.00917.78
8.1.210.0080.00018.88
8.1.200.0030.00617.35
8.1.190.0040.00417.35
8.1.180.0000.00818.10
8.1.170.0000.00918.46
8.1.160.0030.00522.19
8.1.150.0070.00019.03
8.1.140.0000.00817.72
8.1.130.0040.00418.91
8.1.120.0040.00317.47
8.1.110.0040.00417.44
8.1.100.0030.00617.39
8.1.90.0070.00317.53
8.1.80.0000.01117.47
8.1.70.0000.00717.50
8.1.60.0050.00317.53
8.1.50.0050.00517.43
8.1.40.0030.00617.43
8.1.30.0070.00417.71
8.1.20.0020.00517.70
8.1.10.0030.00617.49
8.1.00.0000.00717.39
8.0.300.0000.00819.60
8.0.290.0090.00016.63
8.0.280.0040.00418.35
8.0.270.0000.00717.28
8.0.260.0000.00718.96
8.0.250.0000.00716.96
8.0.240.0070.00016.98
8.0.230.0070.00016.85
8.0.220.0000.00716.94
8.0.210.0050.00216.84
8.0.200.0000.00716.92
8.0.190.0060.00316.86
8.0.180.0070.00016.92
8.0.170.0060.00316.91
8.0.160.0000.00716.91
8.0.150.0000.00716.83
8.0.140.0000.00716.87
8.0.130.0030.00313.42
8.0.120.0000.00716.85
8.0.110.0040.00416.95
8.0.100.0050.00316.84
8.0.90.0070.00016.96
8.0.80.0120.00316.84
8.0.70.0000.00916.86
8.0.60.0000.00716.80
8.0.50.0070.00016.76
8.0.30.0120.00617.15
8.0.20.0060.01417.40
8.0.10.0070.00016.99
8.0.00.0060.01016.63
7.4.330.0000.00515.55
7.4.320.0060.00016.63
7.4.300.0030.00316.67
7.4.290.0030.00716.66
7.4.280.0050.00316.53
7.4.270.0000.00716.55
7.4.260.0040.00416.43
7.4.250.0030.00416.40
7.4.240.0000.00716.45
7.4.230.0000.00716.69
7.4.220.0040.00416.60
7.4.210.0100.00716.57
7.4.200.0050.00216.65
7.4.160.0070.01116.51
7.4.140.0120.00717.86
7.4.130.0120.00616.35
7.4.120.0080.01116.56
7.4.110.0080.01216.34
7.4.100.0060.01016.64
7.4.90.0060.01016.46
7.4.80.0080.01119.39
7.4.70.0140.00316.40
7.4.60.0120.00316.42
7.4.50.0100.00716.39
7.4.40.0130.01016.56
7.4.00.0110.00415.11
7.3.330.0030.00313.38
7.3.320.0030.00313.36
7.3.310.0000.00716.23
7.3.300.0030.00316.38
7.3.290.0070.00016.39
7.3.280.0050.00916.35
7.3.260.0110.00816.49
7.3.240.0090.00916.58
7.3.230.0060.01116.38
7.3.210.0100.01316.63
7.3.200.0060.01516.39
7.3.190.0100.00716.55
7.3.180.0060.01016.67
7.3.170.0030.01316.30
7.3.160.0070.01016.43
7.3.120.0100.00614.77
7.3.110.0090.00614.94
7.3.100.0040.01114.70
7.3.90.0030.01314.60
7.3.80.0060.00614.52
7.3.70.0000.01014.76
7.3.60.0060.00314.79
7.3.50.0040.01114.94
7.3.40.0000.01314.96
7.3.30.0070.00714.98
7.3.20.0100.00016.69
7.3.10.0140.00016.37
7.3.00.0080.00816.58
7.2.330.0120.01616.65
7.2.320.0070.01016.71
7.2.310.0160.00016.88
7.2.300.0030.01316.77
7.2.290.0130.00316.83
7.2.240.0000.01714.61
7.2.230.0030.01314.96
7.2.220.0060.00915.03
7.2.210.0060.00915.11
7.2.200.0000.01115.03
7.2.190.0030.00915.02
7.2.180.0040.00414.85
7.2.170.0000.01315.20
7.2.160.0000.01415.14
7.2.150.0030.00916.95
7.2.140.0000.01316.82
7.2.130.0090.00617.14
7.2.120.0000.01117.01
7.2.110.0030.01417.03
7.2.100.0100.00416.67
7.2.90.0040.01117.15
7.2.80.0050.00717.00
7.2.70.0060.00617.05
7.2.60.0070.00716.97
7.2.50.0180.01416.70
7.2.40.0320.00717.43
7.2.30.0340.00617.60
7.2.20.0370.00617.50
7.2.10.0310.01117.38
7.2.00.0490.00917.52
7.1.330.0060.00915.66
7.1.320.0070.00315.92
7.1.310.0000.00916.05
7.1.300.0070.00715.66
7.1.290.0030.01015.61
7.1.280.0040.00715.89
7.1.270.0110.00415.71
7.1.260.0030.00615.55
7.1.250.0090.00315.78
7.1.200.0110.00015.64
7.1.160.0540.01116.91
7.1.150.0990.00817.03
7.1.140.0620.01416.97
7.1.130.0680.01217.05
7.1.120.0640.01316.75
7.1.110.0680.01216.15
7.1.100.0880.01116.41
7.1.90.0750.01416.07
7.1.80.0640.01016.47
7.1.70.0720.00615.41
7.1.60.0910.01733.43
7.1.50.0910.01232.95
7.1.40.1060.01032.81
7.1.30.1450.01432.60
7.1.20.1380.01332.75
7.1.10.1030.01514.85
7.1.00.1300.01714.65

preferences:
79.83 ms | 403 KiB | 5 Q