On 15 Jul 2014, at 06:50, Kris Craig <kris.cr...@gmail.com> wrote:

> 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.

We use \ for namespaces, and Python 3’s // obviously can’t be used, so I might 
suggest Pascal’s div operator:

$minutes = ($s div 60) % 60;

Failing that, div() as a built-in function much like pow() is:

$minutes = div($s, 60) % 60;
--
Andrea Faulds
http://ajf.me/





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

Reply via email to