HardCoreMore Posted September 7, 2010 Share Posted September 7, 2010 What am i missing here why echo 0 == "some string" prints out 1? Quote Link to comment https://forums.phpfreaks.com/topic/212765-0-some-string-returns-1/ Share on other sites More sharing options...
Zane Posted September 7, 2010 Share Posted September 7, 2010 I'm not exactly sure why, but it's in the manual at least http://www.php.net/manual/en/language.types.boolean.php#86809 Quote Link to comment https://forums.phpfreaks.com/topic/212765-0-some-string-returns-1/#findComment-1108260 Share on other sites More sharing options...
PFMaBiSmAd Posted September 7, 2010 Share Posted September 7, 2010 The number in a comparison takes priority. The string is converted to a number and any non-numeric string is a zero. See the loose type comparison at this link - http://php.net/manual/en/types.comparisons.php Quote Link to comment https://forums.phpfreaks.com/topic/212765-0-some-string-returns-1/#findComment-1108262 Share on other sites More sharing options...
HardCoreMore Posted September 7, 2010 Author Share Posted September 7, 2010 that makes sense now. thanks You are user type "PHPFreaks Recommended 'Insane!'" haahaha. cool Quote Link to comment https://forums.phpfreaks.com/topic/212765-0-some-string-returns-1/#findComment-1108264 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.