I was wondering if there is a easy way to display the 8 bits of a byte(or char) in PHP.
For example for ASCII encoding the character \'0\' should return 0011 0000
This should do the job:
$bin = decbin(ord($char)); $bin = str_pad($bin, 8, 0, STR_PAD_LEFT);