Re: bitwise operations and Unicode strings

From: Date: Tue, 29 May 2007 15:06:27 +0000
Subject: Re: bitwise operations and Unicode strings
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-29867@lists.php.net to get a copy of this message
On 5/29/07, Antony Dovgal <antony@zend.com> wrote:
Hello. Do you think the engine should support bitwise operators and Unicode strings? If yes, how do you think it should work? Example: <?php $a = "1"; $a|="2"; var_dump($a); ?> This code outputs "3" in native mode and "Fatal error: Unsupported operand types" in Unicode mode. I believe this is an inconsistency and it should be possible to use Unicode strings there.
Definitely
There are several possible ways to implement it: 1) the same as with native strings - apply the operator to each element of the string separately; 2) convert the string to binary (using say iso-8859-1) and then see 1);
I would probably be for the solution #2 and of course using the unicode.runtime_encoding ini setting to convert it to binary.
We can also leave it as is (since it doesn't seem very useful) or even drop the native strings support (it doesn't seem very useful to me either).
I think this is a bad choice.. might not be useful to you, but might be to some other people
Opinions? -- Wbr, Antony Dovgal -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
-- David Coallier

« previous php.internals (#29867) next »