note 82397 added to function.ip2long
| From: | lutel at osu1 dot php dot net | Date: | Wed, 09 Apr 2008 11:45:47 +0000 |
| Subject: | note 82397 added to function.ip2long | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138054@lists.php.net to get a copy of this message | ||
here is netMatch function which is the fastest I could wrote, I hope developers will include native
function soon...
function netMatch ($CIDR,$IP) {
list ($net, $mask) = explode ('/', $CIDR);
return ( ip2long ($IP) & ~((1 << (32 - $mask)) - 1) ) == ip2long ($net);
}
----
Server IP: 82.160.94.10
Probable Submitter: 85.222.9.113
----
Manual Page -- http://www.php.net/manual/en/function.ip2long.php
Edit -- https://master.php.net/note/edit/82397
Del: integrated -- https://master.php.net/note/delete/82397/integrated
Del: useless -- https://master.php.net/note/delete/82397/useless
Del: bad code -- https://master.php.net/note/delete/82397/bad+code
Del: spam -- https://master.php.net/note/delete/82397/spam
Del: non-english -- https://master.php.net/note/delete/82397/non-english
Del: in docs -- https://master.php.net/note/delete/82397/in+docs
Del: other reasons-- https://master.php.net/note/delete/82397
Reject -- https://master.php.net/note/reject/82397
Search -- https://master.php.net/manage/user-notes.php