|
Posted by deko on 02/11/07 08:57
geturl 2.0...
> 1. Increase the error_reporting level and you will find some sloppy notices
so I have a few undefined variables... I thought this did not matter with PHP
(script vs. compiled code)
> 2. Have a look at parse_url(), which might be useful
well, if urlString = http://netforex.subdomain.net.foo'>, parse_url() returns:
netforex.subdomain.net.foo'> - which is not much help. Nevertheless, I'm using
it on line 79 for validation - but I think it would be better validation if I
could do this:
if ($urlLink = parse_url($urlLink))
{
return $urlLink['host'];
}
??
> 3. Use preg_* functions instead of POSIX ereg* function (performance)
I was able to replace an eregi with preg_match on lines 18 and 29, but unsure of
the syntax for line 44 ... suggestions?
> 4. Strings like the following cause infinite loops:
>
> getURL('fofo http://discovery.co.uk/../foo');
fixed! see line 38.
- - - - -
I'm wondering how much of a hack that for loop is (lines 26 - 53). Seems to
work okay...
Navigation:
[Reply to this message]
|