CodeExplorer _toIp example
} $host =
explode("/",
$subnetData);
$binaryHost = "";
$tmp =
explode(".",
$host[0
]);
for ($i = 0;
$i < 4 ;
$i++
) { $binaryHost .=
str_pad(decbin($tmp[$i]), 8, "0", STR_PAD_LEFT
);
} $segmentData = array
( 'network' =>
(int)$this->
_toIp(str_pad(substr($binaryHost, 0,
$host[1
]), 32, 0
)),
'broadcast' =>
(int)$this->
_toIp(str_pad(substr($binaryHost, 0,
$host[1
]), 32, 1
)) );
for ($j =
$i;
$j < 4;
$j++
) { if ((int)$octet[$j] <
$segmentData['network'
][$j] ||
(int)$octet[$j] >
$segmentData['broadcast'
][$j]) { return false;
} } }