On 02/22/2015 09:15 PM, Stanislav Malyshev wrote:
We were talking about the case where the argument was even, you must have missed that part. If the argument is not even, indeed both models would produce the same error, no difference there. The only difference in your model vs. dynamic model so far is that you forced the developer to do manual (int) instead of doing much smarter coercive check on entrance of foo(). There's no performance improvement in that and there's reliability decrease.
How is coercive much smarter? Basically what coercive would do is similar to what the intval(), floatval(), etc... set of functions do with some type checking on the mix to ensure a value matches some set of rules.
How casting (int) could be such dangerous thing? Lets take for example this code:
echo (int) "whats cooking!"; echo intval("whats cooking"); Both statements print 0, so how is casting unsafe??? -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php