|
Posted by Vince Morgan on 04/20/07 21:33
"Steve" <no.one@example.com> wrote in message
news:MaaWh.1449$go5.1225@newsfe12.lga...
> if you had $h as a public variable and then tried to say $obj->h = 'some
> value', you'd never have __set be called by php.
>
> give that a try and see what i mean.
>
>
class C_Obj
{
public $h=5;
function __set($name, $val)
{
$name = $val;
}
function __get($name)
{
return self::getVal($name);
}
}
$obj = new C_Obj;
$obj->h=15;
echo $obj->h."<br>";
Either my head is now brocken, or my php engine is.
If I understand you correctly, and it's very likely I'm not, the above
shouldn't work. But it does.
Navigation:
[Reply to this message]
|