3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php if (PHP_VERSION_ID < 50400) { die(); } $cases = array( '', ':', '//', '?', '#', 'http', 'http:', 'http://', 'http://hostname', '//hostname', 'http://user:pass@hostname:1234/path/file.ext?foo=bar#id', ); foreach ($cases as $case) { print_r(parse_url($case)); }
Output for 5.4.7 - 7.2.0
Array ( [path] => ) Array ( ) Array ( ) Array ( [path] => http ) Array ( [scheme] => http ) Array ( [scheme] => http [host] => hostname ) Array ( [host] => hostname ) Array ( [scheme] => http [host] => hostname [port] => 1234 [user] => user [pass] => pass [path] => /path/file.ext [query] => foo=bar [fragment] => id )
Output for 5.4.0 - 5.4.6
Array ( [path] => ) Array ( [path] => // ) Array ( ) Array ( ) Array ( [path] => http ) Array ( [scheme] => http ) Array ( [scheme] => http [host] => hostname ) Array ( [path] => //hostname ) Array ( [scheme] => http [host] => hostname [port] => 1234 [user] => user [pass] => pass [path] => /path/file.ext [query] => foo=bar [fragment] => id )
Output for 5.2.7 - 5.3.29
Output for 4.3.0 - 5.2.6
Notice: Use of undefined constant PHP_VERSION_ID - assumed 'PHP_VERSION_ID' in /in/1fCPf on line 3