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. Link to comment https://forums.phpfreaks.com/topic/174451-solved-class-set-varfalse/ 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. Link to comment https://forums.phpfreaks.com/topic/174451-solved-class-set-varfalse/#findComment-919454 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 Link to comment https://forums.phpfreaks.com/topic/174451-solved-class-set-varfalse/#findComment-919457 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 Link to comment https://forums.phpfreaks.com/topic/174451-solved-class-set-varfalse/#findComment-919462 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 Link to comment https://forums.phpfreaks.com/topic/174451-solved-class-set-varfalse/#findComment-919492 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.