Re: Proposal for floored division and modulo functions

From: Date: Tue, 23 Aug 2022 17:27:42 +0000
Subject: Re: Proposal for floored division and modulo functions
References: 1 2 3 4  Groups: php.internals php.internals 
Request: Send a blank email to internals+get-118454@lists.php.net to get a copy of this message
On 2022-08-22 11:49 AM, David Gebler wrote:
The bit I think I might not like is these being functions, floor_div and floor_mod. They may be easily confused with the similarly named and existing fdiv and fmod functions. Wouldn't new operators, // and %% respectively, be preferable?
Speaking to my preferences, yes, I myself would much prefer these to be implemented as operators. However, I was looking back at previous discussions about surrounding intdiv, and it was then also proposed to implement that as an operator (i.e., %%) instead of a function. While implementing the intdiv function was approved, the operator proposal failed. For the same reasons, the operators aren’t being proposed here, but if there’s a change in attitudes concerning new operators, that should definitely be on the table. If we do go down the operator route, however, what tokens should be chosen? %% makes since for floor modulo, but // is already used for comments. * <https://wiki.php.net/rfc/intdiv>

« previous php.internals (#118454) next »