note 25153 deleted from function.ip2long by nicos
| From: | nicos@php.net | Date: | Tue, 04 Feb 2003 00:27:11 +0000 |
| Subject: | note 25153 deleted from function.ip2long by nicos | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-43353@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).