3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url = 'www.example.com/title/page/article/'; //this is the URL $urlArray = explode('/', $url); //Strip down the URL $startURL = $urlArray[0]; //we want to keep this for if the user clicks on start. $urlArray[0] = 'Start'; //replace www.example.com with "start" if($urlArray[count($urlArray) - 1] == ''){ //this checks the last item is being empty or not. array_pop($urlArray); //last item is indeed empty so we just remove it. } $broadCrumb = ''; //create an empty broadCrumb variable Foreach($urlArray as $index =>$value){ //loop through the stripped down url $value = ucfirst($value); //initcap the items $broadCrumbTemp = '<a href="'.$startURL.'/{url}">{linkname}</a>{delimeter}'; //this is the template we are going to use. if($index == (count($urlArray) - 1)){ //if the index is last $broadCrumb .= $value; //just append the item }else{ //if the index isn't last $location = ''; for($i = 1; $i <= $index; $i++){ $location .= $urlArray[$i].'/'; } $replace = array('{url}', '{linkname}', '{delimeter}'); $replaceTo = array($location, $value, ' > '); $broadCrumbTemp = str_ireplace($replace, $replaceTo, $broadCrumbTemp); $broadCrumb .= $broadCrumbTemp; } } echo($broadCrumb); //show the broadCrumb
Output for git.master, git.master_jit, rfc.property-hooks
<a href="www.example.com/">Start</a> > <a href="www.example.com/title/">Title</a> > <a href="www.example.com/title/page/">Page</a> > Article

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:
37.83 ms | 401 KiB | 8 Q