I have a php script in the script I need to understand some code. Can you please guide me to understand the code: Here is the function from the PHP script:
function get_list_ip($ip_addr_cidr){
$ip_arr = explode("/", $ip_addr_cidr);
$bin = "";
for($i=1;$i<=32;$i++) {
$bin .= $ip_arr[1] >= $i ? '1' : '0';
}
$ip_arr[1] = bindec($bin);
$ip = ip2long($ip_arr[0]);
$nm = $ip_arr[1];
$nw = ($ip & $nm);
$bc = $nw | ~$nm;
$bc_long = ip2long(long2ip($bc));
for($zm=1;($nw + $zm)<=($bc_long - 1);$zm++)
{
$ret[]=long2ip($nw + $zm);
}
return $ret;
}
Here is the line I need to understand:
$bin .= $ip_arr[1] >= $i ? '1' : '0';
what is mean by>=
,?
and:
here$nw = ($ip & $nm);
what is&
in variable$bc = $nw | ~$nm;
what is|
here