Zeev,

>> And passing 'hello' to a function type hinted as int? Will people really
>> expect
>> that to become a 0, with a mild warning they may not even have enabled?
>
> I'd say absolutely yes, if they're PHP developers that's exactly what they'd
> expect.  After all, if you use 'hello' today in any integer context in PHP,
> explicit or implicit, that's exactly how it will behavior across the
> language.

Compare:

$ php -r 'var_dump(substr("abc", "1"));'
string(2) "bc"

$ php -r 'var_dump(substr("abc", "1sf"));'
PHP Notice:  A non well formed numeric value encountered in Command
line code on line 1
string(2) "bc"

$ php -r 'var_dump(substr("abc", "apple"));'
PHP Warning:  substr() expects parameter 2 to be long, string given in
Command line code on line 1
NULL

So it's not really how it behaves across the language (especially
since the common paradigm is not run the function if zpp fails, which
it will when passing "apple" to a function expecting an int).

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

Reply via email to