<?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 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.30, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.6 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
- 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 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 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)
preferences:
103.21 ms | 415 KiB | 5 Q