jonniejoejonson Posted September 16, 2009 Share Posted September 16, 2009 I have the following: class testClass{ var $testVar=false;} $testObj = new testClass; if(isset($testObj->testVar)){ print 'testVar is present';} the result is that it prints - 'testVar is present' ... yet i have it set to false... where am i going wtrong.. kind regards J. Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted September 16, 2009 Share Posted September 16, 2009 you have SET it! isset will check to see if the given argument is set. if ((bool)$testObj->testVar === false) is more like what you are after. Quote Link to comment Share on other sites More sharing options...
jonniejoejonson Posted September 16, 2009 Author Share Posted September 16, 2009 That will be the answer... thanks... Can i ask one more question... what is the difference between === and == thanks J Quote Link to comment Share on other sites More sharing options...
Zane Posted September 16, 2009 Share Posted September 16, 2009 === means that they are equal AND they are the same type... like...for instance..a string or integer for example: $thevar = "42"; $thevar2 = 42; $thevar === $thevar2 would be false...because the first one is a string, while this next one is true $thevar == $thevar2 /// TRUE Quote Link to comment Share on other sites More sharing options...
jonniejoejonson Posted September 16, 2009 Author Share Posted September 16, 2009 Thanks zanus, that makes sense... regards J 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.