Reply to Re: Getting and Setting and best practise

Your name:

Reply:


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.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация