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", ]; $seen = []; $siteStructure = []; foreach (URLS as $url) { ['scheme' => $scheme, 'host' => $host, 'path' => $path] = parse_url($url); $realm = $scheme . '://' . $host; $siteStructure[$realm] = isset($siteStructure[$realm]) ? $siteStructure[$realm]: []; $current = &$siteStructure[$realm]; $pathEls = preg_split('/[^a-zA-Z0-9]+/', $path, 0, PREG_SPLIT_NO_EMPTY); foreach ($pathEls as $el) { $current[$el] = isset($current[$el]) ? $current[$el] : []; $current = &$current[$el]; } unset($current); } var_dump($siteStructure);
Output for git.master, git.master_jit, rfc.property-hooks
array(1) { ["http://site.com"]=> array(4) { ["save"]=> array(2) { ["results"]=> array(1) { ["path"]=> array(0) { } } ["path"]=> array(0) { } } ["path"]=> array(2) { ["save"]=> array(1) { ["results"]=> array(0) { } } ["results"]=> array(0) { } } ["Crawler4"]=> array(0) { } ["Crawler"]=> array(0) { } } }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
38.25 ms | 402 KiB | 8 Q