- var_dump: documentation ( source)
- parse_url: documentation ( source)
<?php
$tests = array("http://albertech.net/2011/03/php-find-port-number-from-url-using-regex/","http://albertech.net:80/2011/03/php-find-port-number-from-url-using-regex/","http://185.42.1.139:443/","185.42.1.139:443","185.42.1.139:443/index.php","http://185.42.1.139/cookiechecker.php?uri=/");
foreach($tests as $test) {
var_dump( parse_url($test) );
echo "\n\r\n\r";
}