<?php
function test_bit_position($num, $pos1, $pos2) {
$pos1--;
$pos2--;
$bin_num = strrev(decbin($num));
if ($bin_num[$pos1] == $bin_num[$pos2]) {
return "true";
} else {
return "false";
}
}
echo test_bit_position(112,5,6)."\n";
?>
<?php function multiply_two_lists($x, $y) { $a = explode(' ',trim($x)); $b = explode(' ',trim($y)); foreach($a as $key=>$value) { $output[$key] = $a[$key]*$b[$key]; } return implode(' ',$output); } echo multiply_two_lists(("10 12 3"), ("1 3 3"))."\n"; ?>
Comments
Post a Comment