Yeah, sprintf didn't work for me either, though I'm not sure why. I just tried it again and it still didn't work. With this code:
$num = 1111;
$new_num = sprintf ('%06d', $num);
echo $num;
I get the output 1111. Any idea why it doesn't give me the extra zeros?
Yeah, left zeros don't change the value of binary strings (01111 == 1111), so PHP drops them (probably for speed?), but I need those zeros in this case because I have to string bit strings together and make sure they're aligned. 😉