Hi Leigh,

> On 3 Feb 2015, at 13:20, Leigh <lei...@gmail.com> wrote:
> 
> Hi list,
> 
> How do we feel about a zero-fill right shift operator?
> 
> PHPs current right shift operator preserves signage, but this is not
> always desirable.
> 
> I propose the same syntax as JavaScript for this: >>>
> 
> php -r 'var_dump(-256 >> 8);'
> int(-1)
> 
> php -r 'var_dump(-256 >>> 8);'
> int(16777215)
> 
> This will introduce a T_SHRZF token and corresponding opcode. Targeting PHP 7.

Hmm, how would this interact with bigints? Does it rely on fixed-width 
integers, as it appears to? :/

I think it’s a very obscure use case, too. Might be better to add a function in 
this case, like we did for intdiv().

Thoughts?

--
Andrea Faulds
http://ajf.me/





--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to