Zero-fill right shift.
| From: | Leigh | Date: | Tue, 03 Feb 2015 13:20:22 +0000 |
| Subject: | Zero-fill right shift. | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-81706@lists.php.net to get a copy of this message | ||
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.