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!!! Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
stickman Posted August 19, 2006 Author Share Posted August 19, 2006 Thank you. That answered my question. Quote Link to comment 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.