update page now

Voting

: min(one, four)?
(Example: nine)

The Note You're Voting On

carmageddon at gmail dot com
14 years ago
If you want to convert a decimal (integer) number into constant length binary number in lets say 9 bits, use this:
$binary = sprintf('%08b', $number );
for example: 
<?php
$bin = sprintf('%08b',511 );
echo $bin."\n";
?>

would output 111111111
And 2 would output 00000010
I know the leading zeros are useful to me, perhaps they are to someone else too.

<< Back to user notes page

AltStyle によって変換されたページ (->オリジナル) /