note 25153 added to function.ip2long
| From: | php-general at lists dot php dot net | Date: | Thu, 12 Sep 2002 09:34:51 +0000 |
| Subject: | note 25153 added to function.ip2long | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-36572@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' ;
shouldn't that be :
if ( ($testip & $mask) == ($network & 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+25153
http://master.php.net/manage/user-notes.php?action=delete+25153
http://master.php.net/manage/user-notes.php?action=reject+25153