On 17 Jul 2014, at 00:18, Rowan Collins <rowan.coll...@gmail.com> wrote:
> Now, I have no idea how ZPP actually works, and get lost in a maze of macros > whenever I try to look at it, but evidently it has logic to distinguish, at > least for string->int, three cases: > > 1) safe / lossless / well formed input (cast silently), e.g. '123' => int(123) > 2) unsafe / lossy / non well formed (give a notice), 'e.g. '123abc' => > int(123) > 3) impossible / inappropriate (from the point of view of the user, give a > warning, and cause different behaviour of the function), e.g. 'abc' => int zpp’s casts are (one form of) implicit cast. We actually do multiple different kinds of implicit casts in different places with different results; “0xa” is variously an integer and not an integer, depending on context, because nobody seems to have made their mind up whether is_numeric_string or strtol is used to parse numeric strings. :( The only casts that are explicit are using (int) and friends, or intval() and friends (I believe the two are equivalent). -- Andrea Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php