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\
Hej. I also needed this function and I edit 1 other to return me list of all IP addresses from range. This will return list of IP addresses from CIDR Notation. Enjoy it ;)
= $i ? '1' : '0';
}
$ip_arr[1] = bindec($bin);
$ip = ip2long($ip_arr[0]);
$nm = ip2long($ip_arr[1]);
$nw = ($ip & $nm);
$bc = $nw | (~$nm);
echo "Number of Hosts: " . ($bc - $nw - 1) . "
";
echo "Host Range: " . long2ip($nw + 1) . " -> " . long2ip($bc - 1) . "
". "
";
for($zm=1;($nw + $zm)<=($bc - 1);$zm++)
{
echo long2ip($nw + $zm). "
";
}
?>