like this: $str=b'xxxxxx';
A:
$number = decbin(59);
echo $number . "\n"; //111011
$number = bindec($number);
echo $number . "\n"; //59
decbin(int $number): Returns a string containing a binary representation of the given number argument.
bindec(string $bstring): Returns the decimal equivalent of the binary number in bstring argument.
jitter
2009-11-14 11:52:08
+6
A:
The PHP language reference describes the distinction between unicode strings and native binary strings, denoted with b'this is a binary string'
It doesn't seem to be a method of representing binary numbers.
The notation "is available since PHP 5.2.1. However, it will only have effect as of PHP 6.0.0"
pavium
2009-11-14 11:54:33
+1
A:
"binary string" is what we have in php right now - a sequence of bytes, which (as opposed to C language) can also include nul byte. This is (or will be, as of php6) different from unicode strings, which are sequences of two-byte characters.
stereofrog
2009-11-14 14:12:46