Re: bitwise operations and Unicode strings

From: Date: Sat, 16 Jun 2007 01:58:42 +0000
Subject: Re: bitwise operations and Unicode strings
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-30201@lists.php.net to get a copy of this message
I don't think we should support bitwise ops on Unicode strings. I am not even sure why we support them for normal strings. -Andrei On May 29, 2007, at 2:25 AM, Antony Dovgal 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. 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); 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). Opinions? --Wbr, Antony Dovgal --PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.internals (#30201) next »