On Mon, Jul 14, 2014 at 11:01 AM, Alain Williams <a...@phcomp.co.uk> wrote: > On Mon, Jul 14, 2014 at 12:25:22PM -0400, Anthony Ferrara wrote: > >> IMHO, strict hints are dangerous in the context of PHP because PHP's >> types can change in unpredictable ways. A variable that was an integer >> can turn into a float through seemingly integer operations. Example: >> $a / $b * $b will result in a float unless $b divides $a (even though >> for sane values of $a and $b, it will be exactly representable as an >> int). > > But if you have: > > function foo(int $a) { > ... > $a = 3 / 2; > } > > What do you expect $a to contain ? I would suggest integer 1.
I would expect the same result as 3.0 / 2.0, as would most every new programmer. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php