On Wed, Jul 16, 2014 at 7:34 PM, Andrea Faulds <a...@ajf.me> wrote:
> What are you suggesting you do for an integer division, then? ($a - ($a % 
> $b)) /
> $ b? The division operator already returns an integer. Or should I just use
> intdiv()?
>
It does, but it returns the float truncated result of division.   I'm
suggesting having it to integer division.  So you'd do:  $a / $b and
it's be smart enough to do the right method.

>> If we're really set on adding a new operator, I'd vote for something
>> which provides dividend *and* remainder in some way. (Useful for time
>> arithmetic, for example)
>> In all seriousness, you could just have the compiler optimise using % and %%
> successively with the same operands to just be a single division, if that's
> possible.
>
Assuming you meant / and %, then probably in opcache+'s optimizer.

-Sara

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

Reply via email to