Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75534 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53099 invoked from network); 15 Jul 2014 12:13:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jul 2014 12:13:15 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.200 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.200 imap1-2.ox.privateemail.com Received: from [192.64.116.200] ([192.64.116.200:47535] helo=imap1-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 14/BA-15121-BDA15C35 for ; Tue, 15 Jul 2014 08:13:15 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 81053B00085; Tue, 15 Jul 2014 08:13:12 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap1.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap1.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 15T4Bx60tukp; Tue, 15 Jul 2014 08:13:12 -0400 (EDT) Received: from [192.168.0.15] (unknown [90.210.122.167]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id F2C86B00081; Tue, 15 Jul 2014 08:13:10 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: Date: Tue, 15 Jul 2014 13:13:08 +0100 Cc: Stas Malyshev , PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <7646A8D1-69A2-4255-B048-D3B9F28B422F@ajf.me> <53C47CA2.4050306@sugarcrm.com> <714C2E5E-A321-4993-9CFB-F7DFAC45C532@ajf.me> <53C4B955.5060401@sugarcrm.com> To: Kris Craig X-Mailer: Apple Mail (2.1878.6) Subject: Re: [PHP-DEV] [RFC] intdiv() From: ajf@ajf.me (Andrea Faulds) On 15 Jul 2014, at 06:50, Kris Craig 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=92s // obviously can=92t be used, = so I might suggest Pascal=92s div operator: $minutes =3D ($s div 60) % 60; Failing that, div() as a built-in function much like pow() is: $minutes =3D div($s, 60) % 60; -- Andrea Faulds http://ajf.me/