Getting list IPs from CIDR notation in PHP
Is there a way (or function/class) to get the list of IP addresses from a CIDR notation? For example, I have 73.35.143.32/27 CIDR and want to get the list of all IP's in this notation. Any suggestions? Thank you. jonavon I'll edit the aforementioned class to contain a method for that. Here is the code I came up with that might help you until then. function cidrToRange($cidr) { $range = array(); $cidr = explode('/', $cidr); $range[0] = long2ip((ip2long($cidr[0])) & ((-1 << (32 - (int)$cidr[1])))); $range[1] = long2ip((ip2long($range[0])) + pow(2, (32 - (int)$cidr[1])) - 1); return $range; } var