onenonly Posted August 2, 2009 Share Posted August 2, 2009 <?php // Get Image Height & WIdth class imagedimension{ public $imagewidth; public $imageheight; // contructer function imagedimension(){ $this->imagewidth = '1000'; $this->imageheight = '2000'; } function getwidth(){ return $this->imagewidth; } function getheight(){ return $this->imageheight; } } $test = new imagedimension(); if($test->imagedimension()){ echo $test->getwidth(); echo $test->getheight(); }else{ echo 'bad'; } ?> shouldnt it be true???? usually its true but not in this situation??? Link to comment https://forums.phpfreaks.com/topic/168462-solved-new-object-return-false-automatically/ Share on other sites More sharing options...
gevans Posted August 2, 2009 Share Posted August 2, 2009 The method isn't returning anything, so you're actually testing nothing, as far as php is concerned that is FALSE. Link to comment https://forums.phpfreaks.com/topic/168462-solved-new-object-return-false-automatically/#findComment-888627 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.