Esempio n. 1
0
function ulong2binstr($val)
{
    $binstr = '';
    for ($i = 0; $i < 32; ++$i) {
        $binstr .= readbit_ulong($val, $i);
    }
    return $binstr;
}
function echo_bits($in, $preamble = "", $postamble = "<BR>")
{
    echo $preamble;
    $numBits = strlen($in) * 8;
    for ($i = 0; $i < $numBits; $i++) {
        echo readbit_ulong($in, $i);
        if (($i + 1) % 8 == 0 && $i < $numBits - 1) {
            echo " - ";
        }
    }
    echo $postamble;
}