note 24174 deleted from function.ip2long by irchtml
| From: | irchtml@php.net | Date: | Mon, 09 Feb 2004 02:54:02 +0000 |
| Subject: | note 24174 deleted from function.ip2long by irchtml | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-64855@lists.php.net to get a copy of this message | ||
Note Submitter: php-net@dreams4net.com
----
answer to rk@netuse.de 24-Jul-2002 05:35 :
you don't have to use bc or division to test a mask.
you only have to do a
if ( ($ip & $mask) == $mask ) echo 'ok' ;
where ip and mask are in "long" format. As all this is in 32bit, no +-*/, it should be ok
(and pretty faster).