I am getting the below error in CakePHP, the function works fine in PHP just not Cake, does anyone know why this is not supported or a workaround?
Error: Unsupported operand types
File: /var/www/spitdev/console2/app/Lib/IpLib.php
Line: 40
Notice: If you want to customize this error message, create app/View/Errors/fatal_error.ctp
Function:
public function lastHost($ip_add, $subnet_mask){
$ip = ip2long($ip_add);
$nm = ip2long($subnet_mask);
$nw = ($ip & $nm);
$bc = $nw | (~$nm); <------------LINE 40
$lh = long2ip($bc - 1);
return $lh;
}