|
Posted by Vince Morgan on 04/20/07 23:43
"Vince Morgan" <vinhar@REMOVEoptusnet.com.au> wrote in message
news:46293f1f$0$16554$afc38c87@news.optusnet.com.au...
Well, I was wrong again apparently.
I can set and get the value of a single private member var as long as the
'name' used in the call is anything _but_ the actualy var name.
The more I play with __get and __set, the weirder things get.
The following code should reproduce the behaviour, it does on my 5.0.3.3
version.
<?
class C_Obj
{
private $h=5;
function __set($name, $val)
{
echo "__set() <br>";
$this->name = $val;
}
function __get($name)
{
echo "__get() <br>";
return $this->name;
}
}
$obj = new C_Obj;
$obj->sdfg=15;
echo $obj->d."<br>";
?>
Clearly I have further misunderstandings, and the more I investigate, the
weirder it gets.
Back to the docs.
Navigation:
[Reply to this message]
|