note 30359 added to language.oop

From: Date: Sat, 15 Mar 2003 06:25:31 +0000
Subject: note 30359 added to language.oop
Groups: php.notes 
Request: Send a blank email to php-notes+get-45337@lists.php.net to get a copy of this message
Wow, that's an odd post. <?php class myclass { var $_myvar; function setMyVar($temp){ $this -> $_myvar = $temp; } function getMyVar { return $this -> _myvar; } } $obj = new myclass; $obj -> setMyVar(123); echo $obj -> getMyVar(); ?> That will spit out your 123. If you are going to set as a string use $obj -> setMyVar("asfdas23"); or $var = "asfas"; $obj -> setMyVar($var); Hope that helps you out. -- http://www.php.net/manual/en/language.oop.php http://master.php.net/manage/user-notes.php?action=edit+30359 http://master.php.net/manage/user-notes.php?action=delete+30359 http://master.php.net/manage/user-notes.php?action=reject+30359

« previous php.notes (#45337) next »