3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php error_reporting(-1); ini_set('display_errors', TRUE); print_r(parse_url('/path/?query')); print_r(parse_url('/path')); print_r(parse_url('?query=string')); print_r(parse_url('?query')); print_r(parse_url('query')); print_r(parse_url('//host/path?query=string')); print_r(parse_url('/'));
based on LUR3a
Output for 5.4.7 - 7.2.0
Array ( [path] => /path/ [query] => query ) Array ( [path] => /path ) Array ( [query] => query=string ) Array ( [query] => query ) Array ( [path] => query ) Array ( [host] => host [path] => /path [query] => query=string ) Array ( [path] => / )
Output for 4.3.0 - 5.4.6
Array ( [path] => /path/ [query] => query ) Array ( [path] => /path ) Array ( [query] => query=string ) Array ( [query] => query ) Array ( [path] => query ) Array ( [path] => //host/path [query] => query=string ) Array ( [path] => / )