Re: Package proposal: Net_Ip
| From: | cagrET | Date: | Fri, 30 May 2003 13:30:34 +0000 |
| Subject: | Re: Package proposal: Net_Ip | ||
| References: | 1 2 3 4 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-16832@lists.php.net to get a copy of this message | ||
> Answering the question would have taken you just as much time.
u are talking about the class, but u even didnt see it ... nice ...
> You use return statements that will never get executed.
hmm ? show me where ...
> Client-ip and http-x-forwarded-for headers can be set by anyone,
> and your script would assume that they are the `real ip',
Ok, but there is no other better way to detect Ip through PHP SCRIPT, is
there ?
(btw it checks if Http_x_forwarded has Ip format)
How do u want to detect his Ip ?
> You use ereg_* instead of preg_*.
:) ....
sorry but what will be faster ?
$s = '127.0.0.1, 127.0.0.2, 127.0.0.3';
ereg('^([0-9]{1,3}\.){3,3}[0-9]{1,3}', $s)
or
preg_match('^([0-9]{1,3}\.){3,3}[0-9]{1,3}', $s)
? preg will be faster by 0.00000001 second ?
> Your factory is in reality a singeton, and if you used constants instead
> of properties, it wouldn't be neccessary because you could call the
> methods statically.
There is one problem with PEAR ...
U use everywhere :: on classess instead of -> on objects
What do u gain with this ?
More bloated code ... and more complex , u have to check if isset($this) etc
...
look at the example code
do u really think that using
Net_Ip::get();
is faster than
$ip->get()
?
and what if i change class name ? i will have to change a lot of code ...
Is it so problem to make factory/singleton method to create object or return
instancee of object ?
$ip =& Net_ip::factory();
cheers,
--
cagrET