Re: [RFC] Scalar Type Hinting With Casts (re-opening)
| From: | Andrea Faulds | Date: | Mon, 14 Jul 2014 17:19:23 +0000 |
| Subject: | Re: [RFC] Scalar Type Hinting With Casts (re-opening) | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-75495@lists.php.net to get a copy of this message | ||
On 14 Jul 2014, at 18:14, Alain Williams <addw@phcomp.co.uk> wrote:
> I trust that you meant 1.5 not 0.666.
Er… yes. I somehow misread 3/2 as 2/3.
> I would have expected 1 - since it appears, from the code, that $a should only contain
> integers.
So? PHP doesn’t do integer division. It does what Python 3 does: if two integers cannot divide
cleanly, then a float division is done instead. This may not be what C, C++, C#, Java, or some other
strictly-typed languages do, but it is what PHP does, and has done for a long time. It’s also what
makes the most sense, IMO.
--
Andrea Faulds
http://ajf.me/