Created
August 20, 2014 17:55
-
-
Save cgeisel/d85f1175d570fb20534e to your computer and use it in GitHub Desktop.
parse_url example/feature request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Current behavior: | |
$server_host = 'example.com'; | |
$parsed_url = parse_url($server_host); | |
var_dump($parsed_url); | |
// output: | |
// array (size=1) | |
// 'path' => string 'example.com' (length=11) | |
$server_host = 'http://example.com'; | |
$parsed_url = parse_url($server_host); | |
var_dump($parsed_url); | |
// output: | |
// array (size=2) | |
// 'scheme' => string 'http' (length=4) | |
// 'host' => string 'example.com' (length=11) | |
$server_host = 'example.com:8000'; | |
$parsed_url = parse_url($server_host); | |
var_dump($parsed_url); | |
// output: | |
// array (size=2) | |
// 'host' => string 'example.com' (length=11) | |
// 'port' => int 8000 | |
$server_host = 'example.com/foo'; | |
$parsed_url = parse_url($server_host); | |
var_dump($parsed_url); | |
// output: | |
// array (size=1) | |
// 'path' => string 'example.com/foo' (length=11) | |
Proposed behavior: | |
$server_host = 'example.com'; | |
$parsed_url = parse_url($server_host); | |
var_dump($parsed_url); | |
// output: | |
// array (size=1) | |
// 'host' => string 'example.com' (length=11) | |
$server_host = 'http://example.com'; | |
$parsed_url = parse_url($server_host); | |
var_dump($parsed_url); | |
// output: | |
// array (size=2) | |
// 'scheme' => string 'http' (length=4) | |
// 'host' => string 'example.com' (length=11) | |
$server_host = 'example.com:8000'; | |
$parsed_url = parse_url($server_host); | |
var_dump($parsed_url); | |
// output: | |
// array (size=2) | |
// 'host' => string 'example.com' (length=11) | |
// 'port' => int 8000 | |
$server_host = 'example.com/foo'; | |
$parsed_url = parse_url($server_host); | |
var_dump($parsed_url); | |
// output: | |
// array (size=1) | |
// 'host' => string 'example.com' (length=11) | |
// 'path' => string '/foo' (length=4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment