If you have a string of bits, and want an ASCII representation of them, there are a couple of ways to go, but the easiest is to avail yourself of unpack().
$hex = unpack("H*", $bits);
will give you data in hex. If instead you want numbers, unpack() will do that, too.