3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php header('Content-type: text/plain'); $url = 'http://www.example.com/'; $rel = ':22/path/to/somewhere?query=string#fragment'; var_dump(parse_url($rel), parse_url($url . $rel));
Output for 5.3.3 - 5.6.25, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
bool(false) array(5) { ["scheme"]=> string(4) "http" ["host"]=> string(15) "www.example.com" ["path"]=> string(22) "/:22/path/to/somewhere" ["query"]=> string(12) "query=string" ["fragment"]=> string(8) "fragment" }
Output for 5.2.0 - 5.3.2
Warning: parse_url(:22/path/to/somewhere?query=string#fragment): Unable to parse URL in /in/bbdvV on line 7 bool(false) array(5) { ["scheme"]=> string(4) "http" ["host"]=> string(15) "www.example.com" ["path"]=> string(22) "/:22/path/to/somewhere" ["query"]=> string(12) "query=string" ["fragment"]=> string(8) "fragment" }
Output for 4.3.2 - 5.1.6
Warning: parse_url(:22/path/to/somewhere?query=string#fragment): Unable to parse url in /in/bbdvV on line 7 bool(false) array(5) { ["scheme"]=> string(4) "http" ["host"]=> string(15) "www.example.com" ["path"]=> string(22) "/:22/path/to/somewhere" ["query"]=> string(12) "query=string" ["fragment"]=> string(8) "fragment" }
Output for 4.3.0 - 4.3.1
Warning: parse_url(:22/path/to/somewhere?query=string#fragment) [http://www.php.net/function.parse-url]: Unable to parse url in /in/bbdvV on line 7 bool(false) array(5) { ["scheme"]=> string(4) "http" ["host"]=> string(15) "www.example.com" ["path"]=> string(22) "/:22/path/to/somewhere" ["query"]=> string(12) "query=string" ["fragment"]=> string(8) "fragment" }