3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php header('Content-type: text/plain'); $url = 'http://user:pass@www.example.com'; $rel = '?query=string#fragment'; var_dump(parse_url($rel), parse_url($url . $rel));
Output for 4.3.2 - 7.1.0
array(2) { ["query"]=> string(12) "query=string" ["fragment"]=> string(8) "fragment" } array(6) { ["scheme"]=> string(4) "http" ["host"]=> string(15) "www.example.com" ["user"]=> string(4) "user" ["pass"]=> string(4) "pass" ["query"]=> string(12) "query=string" ["fragment"]=> string(8) "fragment" }
Output for 4.3.0 - 4.3.1
array(2) { ["query"]=> string(12) "query=string" ["fragment"]=> string(8) "fragment" } array(4) { ["scheme"]=> string(4) "http" ["host"]=> string(37) "www.example.com?query=string#fragment" ["user"]=> string(4) "user" ["pass"]=> string(4) "pass" }