For better or for worse, my companys whole infrastructure is duct taped with PHP. It’s ugly as hell, and their systems suck, quite frankly, but it’s the only language i’d be able to write in fast enough to cope with their ever changing demands (I’m still struggling even!) ]]>

function check_bit($value, $n)

{

return $value & pow(2, $n);

}

function uppercase($s) {

$r = “”;

for($i = strlen($s); i > 0; $i–) {

$r .= strtoupper($s[i – 1]);

}

return strrev($r);

}

2.) Your function is then accomplished by:

function setbit(int $value, $n)

{

return (($value & (1< 0);

}

See what that does? It moves your bit to the left N-1 times, and’s it with your value, then checks to see if the result is > 0. If the result is > 0, then the bit is set.

]]>