
Dzsoni Voker - 2009-09-01 12:17:08 -
In reply to message 1 from Dzsoni Voker
Or here is another way to fix this bug, using string functions like the original script:
$color = array(
'High' => bindec(substr(str_pad(decbin(ord($t_c)), 8, "0", STR_PAD_LEFT), 0, 4)),
'Low' => bindec(substr(str_pad(decbin(ord($t_c)), 8, "0", STR_PAD_LEFT), 4))
);
But I think the use of bitwise operators is quicker than calling 5 different functions to get the nibble value.