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)); $params = substr($uri, strlen($base)); } var_dump($baseuri);
Output for 5.1.2 - 7.1.0
string(6) "/start"
Output for 4.3.0 - 5.1.1
Notice: Use of undefined constant PHP_URL_PATH - assumed 'PHP_URL_PATH' in /in/mLXJO on line 3 Warning: parse_url() expects exactly 1 parameter, 2 given in /in/mLXJO on line 3 NULL