note 49406 modified in function.ip2long by danbrown
| From: | danbrown@php.net | Date: | Fri, 05 Dec 2008 13:43:25 +0000 |
| Subject: | note 49406 modified in function.ip2long by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-147699@lists.php.net to get a copy of this message | ||
remixing mediator's function further:
<?php
function matchCIDR($addr, $cidr) {
list($ip, $mask) = explode('/', $cidr);
return (ip2long($addr) >> (32 - $mask) == ip2long($ip) >> (32 - mask));
}
?>
--was--
remixing mediator's function further:
<?php
function matchCIDR($addr, $cidr) {
list($ip, $mask) = explode('/', $cidr);
return (ip2long($addr) >> (32 - $mask) == ip2long($ip) >> (32 - mask));
}
?>
http://php.net/manual/en/function.ip2long.php