Hi, > On 8 Feb 2015, at 20:10, Marc Bennewitz <dev@mabe.berlin> wrote: > > Since PHP-5.2.1 we have an artifact of PHP-6 in the engine means we can > define binary strings but such definitions haven't any effect.
Yes. That’s because PHP 6 was going to have Unicode strings by default, alongside binary strings (to PHP 5 and 7, just “strings”). These “binary strings” are just strings. > So what we can define is the following: > > $str = "str"; > $bin = b"b\0i\0n"; > $str2bin = (binary)$str; > > One of the biggest issue is that currently ALL strings will be handled as > ASCII-7 compatible strings on type-juggling but they aren’t. In the rare case you need to prevent type juggling of binary data, you could wrap it in an object. > It would be very appreciated if PHP could respect such binary declaration: > > * use binary string comparison on compare a binary string to any other string > * don't convert binary strings into integers on array keys > * allow bitwise operators on binary strings without casting to integer This would break existing code which was made “PHP 6-ready”. Also, we already support bitwise operations on strings, I don’t know what you’re on about there... -- Andrea Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php