note 30359 deleted from language.oop by rioter
| From: | rioter@php.net | Date: | Sat, 15 Mar 2003 06:36:53 +0000 |
| Subject: | note 30359 deleted from language.oop by rioter | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-45339@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.