3v4l.org

run code in 200+ PHP versions simultaneously
<?php var_dump(parse_url('//example.org:81/hi?a=b#c=d')); var_dump(parse_url('//example.org/hi?a=b#c=d'));
Output for 5.5.24 - 5.5.38, 5.6.8 - 7.4.0
array(5) { ["host"]=> string(11) "example.org" ["port"]=> int(81) ["path"]=> string(3) "/hi" ["query"]=> string(3) "a=b" ["fragment"]=> string(3) "c=d" } array(4) { ["host"]=> string(11) "example.org" ["path"]=> string(3) "/hi" ["query"]=> string(3) "a=b" ["fragment"]=> string(3) "c=d" }
Output for 5.4.7 - 5.5.23, 5.6.0 - 5.6.7
bool(false) array(4) { ["host"]=> string(11) "example.org" ["path"]=> string(3) "/hi" ["query"]=> string(3) "a=b" ["fragment"]=> string(3) "c=d" }
Output for 5.3.3 - 5.4.6
bool(false) array(3) { ["path"]=> string(16) "//example.org/hi" ["query"]=> string(3) "a=b" ["fragment"]=> string(3) "c=d" }
Output for 5.2.0 - 5.3.2
Warning: parse_url(//example.org:81/hi?a=b#c=d): Unable to parse URL in /in/MpY8k on line 3 bool(false) array(3) { ["path"]=> string(16) "//example.org/hi" ["query"]=> string(3) "a=b" ["fragment"]=> string(3) "c=d" }
Output for 4.3.2 - 5.1.6
Warning: parse_url(//example.org:81/hi?a=b#c=d): Unable to parse url in /in/MpY8k on line 3 bool(false) array(3) { ["path"]=> string(16) "//example.org/hi" ["query"]=> string(3) "a=b" ["fragment"]=> string(3) "c=d" }
Output for 4.3.0 - 4.3.1
array(2) { ["host"]=> string(13) "//example.org" ["port"]=> int(81) } array(3) { ["path"]=> string(16) "//example.org/hi" ["query"]=> string(3) "a=b" ["fragment"]=> string(3) "c=d" }