3v4l.org

run code in 300+ PHP versions simultaneously
<?php function chiii($url,$href){ if(strstr($href,"#")){ if(substr($href,0,1)=="#")return null; $p=explode('#',$href); $href=$p[0]; } if(substr($url,strlen($url)-1,strlen($url))=='/')$base=$url; else $base=dirname($url); if(substr($href,0,2)=="//"){ $p=parse_url($url); return $p['scheme'].$href; }else if(substr($href,0,1)=="/"){ $p=parse_url($url); return $p['scheme']."//".$p['host'].$href; }else if(preg_match('/^https*\:\/\//',$href))return $href; else if(substr($href,0,3)=="../"){ $pat="/^\.\.\//"; echo "back"; while(preg_match($pat,$href)){ $href=preg_replace($pat,'',$href); $base=dirname($base); } return $base."/".$href; }else if(preg_match("/[a-z]+\:/",$href))return null; else return $base.$href; return "NONE"; } $url="http://netor.ir/hello/wel/"; echo chiii($url,"../client#hello"); echo chiii($url,"client/256/"); ?>
Output for git.master, git.master_jit, rfc.property-hooks
backhttp://netor.ir/hello/clienthttp://netor.ir/hello/wel/client/256/

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