- print_r: documentation ( source)
- parse_url: documentation ( source)
<?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));
}