3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); $base = dirname($_SERVER['SCRIPT_NAME']); if (0 === strpos($uri, $base)) { $baseuri = substr($uri, strlen($base)); } var_dump($baseuri);
Output for 5.3.0 - 7.1.0
Notice: Undefined index: REQUEST_URI in /in/VjLBs on line 3 Notice: Undefined variable: baseuri in /in/VjLBs on line 11 NULL
Output for 5.2.3 - 5.2.17
Notice: Undefined index: REQUEST_URI in /in/VjLBs on line 3 Notice: Undefined variable: baseuri in /in/VjLBs on line 11 NULL
Output for 5.1.2 - 5.2.2
Notice: Undefined index: REQUEST_URI in /in/VjLBs on line 3 Notice: Undefined index: SCRIPT_NAME in /in/VjLBs on line 4 Warning: strpos(): Empty delimiter. in /in/VjLBs on line 6 Notice: Undefined variable: baseuri in /in/VjLBs on line 11 NULL
Output for 5.0.4 - 5.1.1
Notice: Undefined index: REQUEST_URI in /in/VjLBs on line 3 Notice: Use of undefined constant PHP_URL_PATH - assumed 'PHP_URL_PATH' in /in/VjLBs on line 3 Warning: parse_url() expects exactly 1 parameter, 2 given in /in/VjLBs on line 3 Notice: Undefined index: SCRIPT_NAME in /in/VjLBs on line 4 Warning: strpos(): Empty delimiter. in /in/VjLBs on line 6 Notice: Undefined variable: baseuri in /in/VjLBs on line 11 NULL
Output for 4.3.2 - 5.0.3
Notice: Undefined index: REQUEST_URI in /in/VjLBs on line 3 Notice: Use of undefined constant PHP_URL_PATH - assumed 'PHP_URL_PATH' in /in/VjLBs on line 3 Warning: parse_url() expects exactly 1 parameter, 2 given in /in/VjLBs on line 3 Notice: Undefined index: SCRIPT_NAME in /in/VjLBs on line 4 Warning: strpos(): Empty delimiter. in /in/VjLBs on line 6 Notice: Undefined variable: baseuri in /in/VjLBs on line 11 NULL
Output for 4.3.0 - 4.3.1
Notice: Undefined index: REQUEST_URI in /in/VjLBs on line 3 Notice: Use of undefined constant PHP_URL_PATH - assumed 'PHP_URL_PATH' in /in/VjLBs on line 3 Warning: parse_url() expects exactly 1 parameter, 2 given in /in/VjLBs on line 3 Notice: Undefined index: SCRIPT_NAME in /in/VjLBs on line 4 Warning: strpos() [http://www.php.net/function.strpos]: Empty delimiter. in /in/VjLBs on line 6 Notice: Undefined variable: baseuri in /in/VjLBs on line 11 NULL