|
Posted by Janwillem Borleffs on 02/11/07 11:14
deko wrote:
> so I have a few undefined variables... I thought this did not matter
> with PHP (script vs. compiled code)
>
It doesn't, but it's just good practice to do so (and increasing the
error_reporting level saves you a lot of time debugging when making typos in
variable names).
> well, if urlString = http://netforex.subdomain.net.foo'>,
> parse_url() returns: netforex.subdomain.net.foo'> - which is not much
>
The parse_url function can indeed easily be fooled, so you will have to add
some additional validation. But it's quite useful for what you are doing
(and pretty fast).
> I was able to replace an eregi with preg_match on lines 18 and 29,
> but unsure of the syntax for line 44 ... suggestions?
>
You mean the following line?
> if (eregi("^(com|net|org...)$", $urlString_a[$i]))
You can simply replace this with:
> if (preg_match("!^(com|net|org...)$!i", $urlString_a[$i]))
JW
Navigation:
[Reply to this message]
|