3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php var_dump(parse_url('/dir/file?param=1&foo=bar&test#id')); var_dump(parse_url('dir/file')); var_dump(parse_url('//example.org/dir/file?param=1&foo=bar&test#id')); var_dump(parse_url('http://example.org/dir/%2Ffile?param=1&foo=bar&test#id')); var_dump(parse_url('http://example.org/dir/../file?param=1&foo=bar&test#id')); var_dump(parse_url('/dir/../file?param=1&foo=bar&test#id'));
Output for 5.4.7 - 7.1.0
array(3) { ["path"]=> string(9) "/dir/file" ["query"]=> string(20) "param=1&foo=bar&test" ["fragment"]=> string(2) "id" } array(1) { ["path"]=> string(8) "dir/file" } array(4) { ["host"]=> string(11) "example.org" ["path"]=> string(9) "/dir/file" ["query"]=> string(20) "param=1&foo=bar&test" ["fragment"]=> string(2) "id" } array(5) { ["scheme"]=> string(4) "http" ["host"]=> string(11) "example.org" ["path"]=> string(12) "/dir/%2Ffile" ["query"]=> string(20) "param=1&foo=bar&test" ["fragment"]=> string(2) "id" } array(5) { ["scheme"]=> string(4) "http" ["host"]=> string(11) "example.org" ["path"]=> string(12) "/dir/../file" ["query"]=> string(20) "param=1&foo=bar&test" ["fragment"]=> string(2) "id" } array(3) { ["path"]=> string(12) "/dir/../file" ["query"]=> string(20) "param=1&foo=bar&test" ["fragment"]=> string(2) "id" }
Output for 4.3.0 - 5.4.6
array(3) { ["path"]=> string(9) "/dir/file" ["query"]=> string(20) "param=1&foo=bar&test" ["fragment"]=> string(2) "id" } array(1) { ["path"]=> string(8) "dir/file" } array(3) { ["path"]=> string(22) "//example.org/dir/file" ["query"]=> string(20) "param=1&foo=bar&test" ["fragment"]=> string(2) "id" } array(5) { ["scheme"]=> string(4) "http" ["host"]=> string(11) "example.org" ["path"]=> string(12) "/dir/%2Ffile" ["query"]=> string(20) "param=1&foo=bar&test" ["fragment"]=> string(2) "id" } array(5) { ["scheme"]=> string(4) "http" ["host"]=> string(11) "example.org" ["path"]=> string(12) "/dir/../file" ["query"]=> string(20) "param=1&foo=bar&test" ["fragment"]=> string(2) "id" } array(3) { ["path"]=> string(12) "/dir/../file" ["query"]=> string(20) "param=1&foo=bar&test" ["fragment"]=> string(2) "id" }