stickman Posted August 19, 2006 Share Posted August 19, 2006 Lets say I have this code:[code]<?php$var = "Text";if($var==0) { echo "A string is equivalent to an integer";} else { echo "A string is NOT equivalent to an integer";}?>[/code]How come everytime I execute that, it outputs:A string is equivalent to an integerI mean, the string "Text" is not the same as the integer 0, so how are they equivalent? Is there something I'm doing wrong or did I miss reading somewhere that a string equals 0 when compared to an integer?Thanks in advance for your help!!! Link to comment https://forums.phpfreaks.com/topic/18007-string-equals-0/ Share on other sites More sharing options...
hitman6003 Posted August 19, 2006 Share Posted August 19, 2006 See this page:http://www.php.net/manual/en/language.types.string.php#language.types.string.conversionand this page:http://www.php.net/manual/en/language.types.type-juggling.php Link to comment https://forums.phpfreaks.com/topic/18007-string-equals-0/#findComment-77102 Share on other sites More sharing options...
stickman Posted August 19, 2006 Author Share Posted August 19, 2006 Thank you. That answered my question. Link to comment https://forums.phpfreaks.com/topic/18007-string-equals-0/#findComment-77103 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.