public static function BitwiseAnd($left_operand, $right_operand) { $val1 = BigNumber::Dec2Bin($left_operand); $val2 = BigNumber::Dec2Bin($right_operand); $len1 = strlen($val1); $len2 = strlen($val2); $maxlen = max($len1, $len2); for ($i = $len1; $i < $maxlen; $i++) { $val1 = "0" . $val1; } for ($i = $len2; $i < $maxlen; $i++) { $val2 = "0" . $val2; } $result = ""; for ($i = 0; $i < $maxlen; $i++) { $char = "0"; if ($val1[$i] == "1" && $val2[$i] == "1") { $char = "1"; } $result = $result . $char; } return BigNumber::Bin2Dec($result); }