Re: [RFC] intdiv()

From: Date: Wed, 16 Jul 2014 15:15:12 +0000
Subject: Re: [RFC] intdiv()
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-75593@lists.php.net to get a copy of this message
On 16 Jul 2014, at 02:51, Bishop Bettini <bishop@php.net> wrote: > TL;DR -- I agree with the principal but want implemented as the infix > operator %% with a test for PHP_INT_MIN %% -1 === false (and a E_WARNING). The RFC has been updated to v0.2. It now proposes a %% operator for integer division (with corresponding %%= assignment operator). However, it returns 0 for the PHP_INT_MIN overflow case like %, rather than FALSE and an E_WARNING. The original intdiv() proposal is kept as a fallback; two votes will be held simultaneously, one 2/3 vote for the %% operator and a 50%+1 for the intdiv() function. If the first fails, then if the second did not, the intdiv() function is implemented instead. This way we’ll still at least have a way to do integer division in PHP, if not a full operator. Nikita Popov doesn’t seem to be a fan of the %% syntax, so it may be subject to change, though I think it’s the best I’ve heard so far. ;) -- Andrea Faulds http://ajf.me/

« previous php.internals (#75593) next »