PHP 6 and non-unicode strings

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have a library that does appends characters to strings (eg. $var.=
chr(45)) and then unpacks them (eg. unpack('N4'), or whatever).

Since PHP 6, however, uses unicode strings, I'm kinda worried that PHP
6 might break my program.  Since I am needing to manipulate strings on
a byte level as opposed to a character level, I don't want $var[4] to
return a two byte character - I want it to return a single byte

My question is...  what can I do to fix this?

I'd rather not do something like ini_set because, although the
library, itself, may use byte strings, the script including the
library might not.

Any ideas?

Re: PHP 6 and non-unicode strings

Quoted text here. Click to load it

My guess is that there is a native Unicode string type, for human-
readable text, and a distinct binary string type, for applications
such as yours. Presumably, fread('bla', 'rb') would return the binary
type (because of the 'b'), or you may cast it to the right type.

Site Timeline