3v4l.org

run code in 200+ PHP versions simultaneously
<?php var_dump( parse_url( 'http://127.0.0.1:80' ), parse_url( 'http://[::1]:80' ), parse_url( 'http://127.0.0.1' ), // Local IPv4 parse_url( 'http://104.205.87.98' ), // Public IPv4 parse_url( 'http://201.152.36.103:58749' ), // IPv4 with port parse_url( 'http://1fff:0:a88:85a3::ac1f' ), // IPv6 parse_url( 'http://[1fff:0:a88:85a3::ac1f]:8001' ) // IPv6 with port );
Output for 5.3.6 - 7.2.6
array(3) { ["scheme"]=> string(4) "http" ["host"]=> string(9) "127.0.0.1" ["port"]=> int(80) } array(3) { ["scheme"]=> string(4) "http" ["host"]=> string(5) "[::1]" ["port"]=> int(80) } array(2) { ["scheme"]=> string(4) "http" ["host"]=> string(9) "127.0.0.1" } array(2) { ["scheme"]=> string(4) "http" ["host"]=> string(13) "104.205.87.98" } array(3) { ["scheme"]=> string(4) "http" ["host"]=> string(14) "201.152.36.103" ["port"]=> int(58749) } bool(false) array(3) { ["scheme"]=> string(4) "http" ["host"]=> string(23) "[1fff:0:a88:85a3::ac1f]" ["port"]=> int(8001) }
Output for 4.3.7 - 5.3.5
array(3) { ["scheme"]=> string(4) "http" ["host"]=> string(9) "127.0.0.1" ["port"]=> int(80) } array(3) { ["scheme"]=> string(4) "http" ["host"]=> string(5) "[::1]" ["port"]=> int(80) } array(2) { ["scheme"]=> string(4) "http" ["host"]=> string(9) "127.0.0.1" } array(2) { ["scheme"]=> string(4) "http" ["host"]=> string(13) "104.205.87.98" } array(3) { ["scheme"]=> string(4) "http" ["host"]=> string(14) "201.152.36.103" ["port"]=> int(58749) } array(2) { ["scheme"]=> string(4) "http" ["host"]=> string(16) "1fff:0:a88:85a3:" } array(3) { ["scheme"]=> string(4) "http" ["host"]=> string(23) "[1fff:0:a88:85a3::ac1f]" ["port"]=> int(8001) }
Output for 4.3.2 - 4.3.6
Warning: parse_url(http://[::1]:80): Unable to parse url in /in/jQppQ on line 5 Warning: parse_url(http://1fff:0:a88:85a3::ac1f): Unable to parse url in /in/jQppQ on line 9 Warning: parse_url(http://[1fff:0:a88:85a3::ac1f]:8001): Unable to parse url in /in/jQppQ on line 10 array(3) { ["scheme"]=> string(4) "http" ["host"]=> string(9) "127.0.0.1" ["port"]=> int(80) } bool(false) array(2) { ["scheme"]=> string(4) "http" ["host"]=> string(9) "127.0.0.1" } array(2) { ["scheme"]=> string(4) "http" ["host"]=> string(13) "104.205.87.98" } array(3) { ["scheme"]=> string(4) "http" ["host"]=> string(14) "201.152.36.103" ["port"]=> int(58749) } bool(false) bool(false)
Output for 4.3.0 - 4.3.1
Warning: parse_url(http://[::1]:80) [http://www.php.net/function.parse-url]: Unable to parse url in /in/jQppQ on line 5 Warning: parse_url(http://1fff:0:a88:85a3::ac1f) [http://www.php.net/function.parse-url]: Unable to parse url in /in/jQppQ on line 9 Warning: parse_url(http://[1fff:0:a88:85a3::ac1f]:8001) [http://www.php.net/function.parse-url]: Unable to parse url in /in/jQppQ on line 10 array(3) { ["scheme"]=> string(4) "http" ["host"]=> string(9) "127.0.0.1" ["port"]=> int(80) } bool(false) array(2) { ["scheme"]=> string(4) "http" ["host"]=> string(9) "127.0.0.1" } array(2) { ["scheme"]=> string(4) "http" ["host"]=> string(13) "104.205.87.98" } array(3) { ["scheme"]=> string(4) "http" ["host"]=> string(14) "201.152.36.103" ["port"]=> int(58749) } bool(false) bool(false)