Is there any possibility to see binary representation of variable?
Like so:
echo decbin(3); // 11
Another solution:
function d2b($dec, $n = 16) {
return str_pad(decbin($dec), $n, "0", STR_PAD_LEFT);
}
Example:
// example:
echo d2b(E_ALL);
echo d2b(E_ALL | E_STRICT);
echo d2b(0xAA55);
echo d2b(5);
Output:
0111011111111111
0111111111111111
1010101001010101
0000000000000101
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With