RE: [PHP-DEV] bitwise operations and Unicode strings
| From: | Andi Gutmans | Date: | Wed, 30 May 2007 03:59:34 +0000 |
| Subject: | RE: [PHP-DEV] bitwise operations and Unicode strings | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-29926@lists.php.net to get a copy of this message | ||
I'd go with (2) for BC sake and as breaking BC here would have very
little value in the first place.
Andi
> -----Original Message-----
> From: Antony Dovgal [mailto:antony@zend.com]
> Sent: Tuesday, May 29, 2007 2:26 AM
> To: php-dev
> Subject: [PHP-DEV] bitwise operations and Unicode strings
>
> 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
>
>