3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $baseuri = $uri = parse_url('http://test.com/start/par/1/2/3', PHP_URL_PATH); $base = dirname('/start/index.php'); if (0 === strpos($uri, $base)) { $baseuri = substr($uri, 0, strlen($base)); } var_dump($baseuri);
Output for 5.1.2 - 7.1.0
string(6) "/start"
Output for 4.3.0 - 5.1.1
<br /> <b>Warning</b>: parse_url() expects exactly 1 parameter, 2 given in <b>/in/VT3qL</b> on line <b>3</b><br /> NULL