<?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 word_digit($word) { $warr = explode(';',$word); $result = ''; foreach($warr as $value){ switch(trim($value)){ case 'zero': $result .= '0'; break; case 'one': $result .= '1'; break; case 'two': $result .= '2'; ...
Comments
Post a Comment