3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $url = 'https://user:pass@host.example.com:1234/path;p=1?query=2&r[]=3#fragment'; var_dump( parse_url( $url ) ); $url = 'https://user:pass@[::FFFF::127.0.0.1]:1234/path;p=1?query=2&r[]=3#fragment'; var_dump( parse_url( $url ) );
Output for 4.3.7 - 7.2.0
array(8) { ["scheme"]=> string(5) "https" ["host"]=> string(16) "host.example.com" ["port"]=> int(1234) ["user"]=> string(4) "user" ["pass"]=> string(4) "pass" ["path"]=> string(9) "/path;p=1" ["query"]=> string(13) "query=2&r[]=3" ["fragment"]=> string(8) "fragment" } array(8) { ["scheme"]=> string(5) "https" ["host"]=> string(19) "[::FFFF::127.0.0.1]" ["port"]=> int(1234) ["user"]=> string(4) "user" ["pass"]=> string(4) "pass" ["path"]=> string(9) "/path;p=1" ["query"]=> string(13) "query=2&r[]=3" ["fragment"]=> string(8) "fragment" }
Output for 4.3.2 - 4.3.6
array(8) { ["scheme"]=> string(5) "https" ["host"]=> string(16) "host.example.com" ["port"]=> int(1234) ["user"]=> string(4) "user" ["pass"]=> string(4) "pass" ["path"]=> string(9) "/path;p=1" ["query"]=> string(13) "query=2&r[]=3" ["fragment"]=> string(8) "fragment" } Warning: parse_url(https://user:pass@[::FFFF::127.0.0.1]:1234/path;p=1?query=2&r[]=3#fragment): Unable to parse url in /in/XZ9Na on line 9 bool(false)
Output for 4.3.0 - 4.3.1
array(8) { ["scheme"]=> string(5) "https" ["host"]=> string(16) "host.example.com" ["port"]=> int(1234) ["user"]=> string(4) "user" ["pass"]=> string(4) "pass" ["path"]=> string(9) "/path;p=1" ["query"]=> string(13) "query=2&r[]=3" ["fragment"]=> string(8) "fragment" } Warning: parse_url(https://user:pass@[::FFFF::127.0.0.1]:1234/path;p=1?query=2&r[]=3#fragment) [http://www.php.net/function.parse-url]: Unable to parse url in /in/XZ9Na on line 9 bool(false)