While it's not the prettiest of side effects in php, I don't agree it should be 
"fixed"

On top of a massive BC break, it's not as if the results are inconsistent. 
Learning php means learning how type juggling works. 

At most, I'd remove the part that truncates numeric strings like "123abc" and 
always convert them to 0, because that's almost *never* an intended effect. One 
could argue that "123" == 123 is, however.


On May 7, 2012, at 6:25 PM, Raymond Irving wrote:

> I was very surprised when I came across the == issue sometime ago. IMO
> strings should be compared as strings. They should never be converted to
> integer.
> 
> 
> 1=="1"          // always convert the number value to a string and then
> compare it
> "foo" == 0    //  should return false
> 
> "123abc" == "123nth" // compare as string. Do not convert to numeric values
> 
> "0"==0     //  true
> 0=="0."  // false
> 
> PHP is great but if we can work together to remove the flaws, then we can
> make it even greater. We have to leave the past behind us and look at where
> we want PHP to be in the next 5 years
> 
> 
> Best regards,


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

Reply via email to