On 14 Jul 2014, at 18:01, Alain Williams <a...@phcomp.co.uk> wrote:

> But if you have:
> 
>    function foo(int $a) {
>        ...
>       $a = 3 / 2;
>    }
> 
> What do you expect $a to contain ? I would suggest integer 1.

I’d expect (and I think most people new to PHP would expect) what 3/2 would be 
in normal maths, i.e. the fractional value 0.666…. Actually, this makes a good 
case for return type hinting, as you could ensure you’d get an integer result 
here. (But that is another matter.)

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