3v4l.org

run code in 300+ PHP versions simultaneously
<?php const URLS = [ "http://site.com/", "http://site.com/save", "http://site.com/save/results", "http://site.com/save/results/path", "http://site.com/path/save/results", "http://site.com/save/path", "http://site.com/path/results", "http://site.com/Crawler4", "http://site.com/Crawler", ]; $siteStructure = []; foreach (URLS as $url) { // Parse the URL into components ['scheme' => $scheme, 'host' => $host, 'path' => $path] = parse_url($url); // build the slug for the top-level element $realm = $scheme . '://' . $host; // create the top levekl element and get a reference to it $siteStructure[$realm] = $siteStructure[$realm] ?? []; $current = &$siteStructure[$realm]; // parse the path into parts $pathEls = preg_split('/[^a-zA-Z0-9]+/', $path, 0, PREG_SPLIT_NO_EMPTY); foreach ($pathEls as $el) { // for each part, make sure the child array exists and overwrite the reference to the child $current[$el] = $current[$el] ?? []; $current = &$current[$el]; } // delete the reference at the end of the loop to prevent accidents unset($current); } var_dump($siteStructure);

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.0160.00616.71
8.3.50.0160.00316.70
8.3.40.0140.00718.91
8.3.30.0070.00718.84
8.3.20.0020.00524.18
8.3.10.0060.00324.66
8.3.00.0020.00526.16
8.2.180.0030.01425.92
8.2.170.0090.00619.05
8.2.160.0120.00322.96
8.2.150.0000.00825.66
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0040.00419.77
8.2.110.0030.00622.27
8.2.100.0090.00317.72
8.2.90.0040.00417.88
8.2.80.0000.00819.02
8.2.70.0040.00417.93
8.2.60.0000.01217.62
8.2.50.0040.00417.88
8.2.40.0050.00317.88
8.2.30.0040.00418.05
8.2.20.0000.00718.07
8.2.10.0030.00521.05
8.2.00.0050.00319.31
8.1.280.0060.01025.92
8.1.270.0000.00823.99
8.1.260.0070.00026.35
8.1.250.0000.00828.09
8.1.240.0050.00523.83
8.1.230.0090.00318.94
8.1.220.0050.00317.74
8.1.210.0050.00318.77
8.1.200.0030.00617.48
8.1.190.0090.00517.35
8.1.180.0050.00318.10
8.1.170.0090.00017.62
8.1.160.0000.00718.97
8.1.150.0040.00418.96
8.1.140.0080.00018.92
8.1.130.0030.00320.07
8.1.120.0040.00417.55
8.1.110.0040.00417.58
8.1.100.0000.00717.51
8.1.90.0000.00817.61
8.1.80.0030.00617.51
8.1.70.0030.00317.43
8.1.60.0000.00917.63
8.1.50.0060.00317.56
8.1.40.0040.00417.63
8.1.30.0000.00817.76
8.1.20.0080.00017.75
8.1.10.0030.00517.73
8.1.00.0040.00417.67
8.0.300.0000.00718.77
8.0.290.0040.00416.88
8.0.280.0030.00318.45
8.0.270.0040.00418.16
8.0.260.0030.00318.36
8.0.250.0070.00017.11
8.0.240.0040.00417.09
8.0.230.0030.00317.10
8.0.220.0000.00716.94
8.0.210.0070.00017.05
8.0.200.0000.00717.05
8.0.190.0000.00817.14
8.0.180.0000.00716.97
8.0.170.0090.00017.09
8.0.160.0040.00416.93
8.0.150.0040.00416.94
8.0.140.0040.00417.00
8.0.130.0000.00513.50
8.0.120.0030.00516.92
8.0.110.0070.00016.85
8.0.100.0100.00016.97
8.0.90.0050.00316.93
8.0.80.0080.00816.97
8.0.70.0070.00017.14
8.0.60.0040.00416.99
8.0.50.0080.00016.93
8.0.30.0120.00817.43
8.0.20.0110.00817.05
8.0.10.0190.00017.09
8.0.00.0150.00617.29
7.4.330.0050.00015.55
7.4.320.0070.00016.75
7.4.300.0000.00716.79
7.4.290.0030.00316.66
7.4.280.0080.00516.70
7.4.270.0030.00616.61
7.4.260.0000.00513.49
7.4.250.0050.00316.76
7.4.240.0000.00716.72
7.4.230.0040.00416.51
7.4.220.0030.00316.62
7.4.210.0040.01216.77
7.4.200.0050.00216.51
7.4.140.0070.01016.36
7.4.130.0090.00916.59
7.4.120.0110.00716.48
7.4.110.0120.00616.55
7.4.100.0090.00916.71
7.4.90.0120.00616.51
7.4.80.0110.00716.67
7.4.70.0130.00516.66
7.4.60.0200.00616.92
7.4.50.0120.01216.38
7.4.40.0030.01416.36
7.4.30.0120.00816.75
7.4.20.0110.00716.66
7.4.10.0090.01016.22
7.4.00.0180.00016.85
7.3.330.0040.00416.52
7.3.320.0000.00713.21
7.3.310.0000.00716.62
7.3.300.0060.00016.55
7.3.290.0040.01216.49
7.3.260.0120.00616.48
7.3.250.0090.01016.46
7.3.240.0160.00316.69
7.3.230.0120.00616.38
7.3.220.0120.00616.80
7.3.210.0120.00616.63
7.3.200.0110.00616.77
7.3.190.0180.00616.58
7.3.180.0170.00716.40
7.3.170.0160.00216.68
7.3.160.0090.00916.81
7.3.150.0100.00716.55
7.3.140.0040.01316.52
7.3.130.0060.01216.55
7.3.120.0110.00716.49
7.3.110.0140.00316.49
7.3.100.0100.00716.34
7.3.90.0090.00916.62
7.3.80.0130.00716.66
7.3.70.0110.00816.58
7.3.60.0170.00016.46
7.3.50.0070.01016.58
7.3.40.0120.00616.49
7.3.30.0140.00316.61
7.3.20.0120.00616.39
7.3.10.0110.00616.50
7.3.00.0140.00416.56

preferences:
51.98 ms | 400 KiB | 5 Q