HardCoreMore Posted September 7, 2010 Share Posted September 7, 2010 What am i missing here why echo 0 == "some string" prints out 1? 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 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 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 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
Archived
This topic is now archived and is closed to further replies.