bitwise operations and Unicode strings

From: Date: Tue, 29 May 2007 09:25:41 +0000
Subject: bitwise operations and Unicode strings
Groups: php.internals 
Request: Send a blank email to internals+get-29861@lists.php.net to get a copy of this message
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

« previous php.internals (#29861) next »