= 0; $p--) { $res .= ($bin & (1 << $p)) ? "1" : "0"; if(32-$p == $split) $res .= " "; if($p > 0 && $p % 8 == 0) $res .= "."; } return $res; } $ip = get($_GET, 'ip'); $mask = get($_GET, 'mask'); $cidr = get($_GET, 'cidr'); if($mask) $cidr = net2cidr(ip2long($mask)); else if($cidr) $mask = long2ip(cidr2net($cidr)); if($mask) { $lIp = ip2long($ip ? $ip : ''); $lMask = ip2long($mask); $lNet = $lIp & $lMask; $lBroadcast = $lNet | (~$lMask); $lMin = $lNet + 1; $lMax = $lBroadcast - 1; $net = long2ip($lNet); $broadcast = long2ip($lBroadcast); $min = long2ip($lMin); $max = long2ip($lMax); $bIp = bin2string($lIp, $cidr); $bMask = bin2string($lMask, $cidr); $bNet = bin2string($lNet, $cidr); $bBroadcast = bin2string($lBroadcast, $cidr); $bMin = bin2string($lMin, $cidr); $bMax = bin2string($lMax, $cidr); } ?> 26th.net - ip calc

ip calc

ip
mask
cidr
 

result

ip
mask
net/
broadcast
min host
max host
source code is also available