note 24174 added to function.ip2long
| From: | php-net at dreams4net dot com | Date: | Thu, 08 Aug 2002 15:31:13 +0000 |
| Subject: | note 24174 added to function.ip2long | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-34532@lists.php.net to get a copy of this message | ||
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).
--
http://www.php.net/manual/en/function.ip2long.php
http://master.php.net/manage/user-notes.php?action=edit+24174
http://master.php.net/manage/user-notes.php?action=delete+24174
http://master.php.net/manage/user-notes.php?action=reject+24174