ID: 20726 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Documentation problem PHP Version: 4.2.3 New Comment:
IMO it can be documented better indeed, for example at this page: http://www.php.net/manual/en/language.operators.comparison.php Derick Previous Comments: ------------------------------------------------------------------------ [2002-11-29 08:39:13] [EMAIL PROTECTED] yesterday i submitted an 'foo'==0 bug (id=20708) in the Scripting Engine problem Category, well i understand that was stupid and my bug went bogus just as ahundret other submitted 'foo'==0 bugs i later found in the database. but i think it is an issue. the manual states: Example: $a == $b Name: Equal Result: TRUE if $a is equal to $b this is not specific enough for a language where 'foo'==0 evaluates TRUE. when i write 'foo'==0 i do *not* want to know if they are same type i want to know one of those: 'foo'==(string)0 *or* (int)'foo'==0 obviously, only one of those can happen. if you want the other thing to happen, you must cast explicitly. the manual doesn't state which one happens implicitly. automatic type casting is great for coding, but one can't just let it happen, one must know exactly what it does. i hope you understand that a nonempty string to be the same as a zero integer messes with the brain of any php newbie used to fixed type languages if you don't explain to him why. the manual shouldn´t just state that 'foo' equals to 0, because for this to happen php seems to use a cast precedence for comparison operations - whatever it is, the manual should explain it. PS: if you bogus me again i wont insist. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20726&edit=1 -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php