3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $server['REQUEST_URI'] = '/index.php?x/'; $server['HTTP_HOST'] = 'neos.dev'; $host = isset($server['HTTP_HOST']) ? $server['HTTP_HOST'] : 'localhost'; $requestUri = isset($server['REQUEST_URI']) ? $server['REQUEST_URI'] : '/'; $requestUri = str_replace('/index.php', '', $requestUri); $uriString = 'http://' . $host . $requestUri; $uriParts = parse_url($uriString); var_dump($uriParts);
based on OlMTh
Output for 5.6.28, 7.0.14 - 7.1.0
array(3) { ["scheme"]=> string(4) "http" ["host"]=> string(8) "neos.dev" ["query"]=> string(2) "x/" }
Output for 4.3.0 - 5.6.21, hhvm-3.12.0, 7.0.0 - 7.0.6
array(3) { ["scheme"]=> string(4) "http" ["host"]=> string(10) "neos.dev?x" ["path"]=> string(1) "/" }
Output for hhvm-3.10.0

Process exited with code 153.