i has the variable $ a = 5; I want to show it in binary form, with a length equal to 8, with the entry * in white spaces, just like this * * * * * 101
here is the script
$number = 5;
printf("%*8b", $number);
it does not work with *, but if "0" -s works
printf("%08b", $number);
//returns 00000101
why doesn't it work with *?
EDIT:
and how can i apply a floating parameter? as
`printf("%.4f", $number);`
//it returns 5.0000, but i want to return *****101.0000
source
share