Re: [RFC] intdiv()
| From: | Kris Craig | Date: | Tue, 15 Jul 2014 05:50:47 +0000 |
| Subject: | Re: [RFC] intdiv() | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-75527@lists.php.net to get a copy of this message | ||
On Mon, Jul 14, 2014 at 10:17 PM, Stas Malyshev <smalyshev@sugarcrm.com>
wrote:
> Hi!
>
> > Both of those are likely not to be installed on most systems. Why do
>
> Why not? bcmath is in core since forever and has no external
> requirements, gmp builds practically everywhere too. AFAIR all distros
> have it.
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
While a practical argument can certainly be made that existing solutions
can fit the examples OP cited, I don't think that takes away from the
underlying principle of the argument: That there's no reason *not* to
include a basic integer division in PHP. It's never made sense to me why
it wasn't included. Rather than an intdiv() function, though, I wonder if
an operator would be a better approach. Some languages I've seen that use
/ as the division operator will use a \ as the integer division operator.
--Kris