I'm looking for quick/simple/(maybe built in that i never noticed before), method for matching a given IP4 dotted quad IP to a CIDR notation mask.
I have a bunch of IPs I need to see if they match a range of IPs.
example:
$ips = array('10.2.1.100', '10.2.1.101', '10.5.1.100', '1.2.3.4');
foreach($ips as $IP)
{
if( cidr_match($IP, '10.2.0.0/16') == true )
{ print "your in the 10.2 subnet\n"; }
}
solve for cidr_match()
it doesnt really have to be simple, but fast would be good. anything that uses only built in/common functions is a bonus (as i'm likely to get one person to show me something in pear that does this, but i cant depend on pear or that package being installed where my code is deployed)