__get, __set, __clone
| From: | Yann Larrivee | Date: | Tue, 08 Jul 2003 21:00:26 +0000 |
| Subject: | __get, __set, __clone | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-154435@lists.php.net to get a copy of this message | ||
Hi, in the past 2 days i have been looking into php5 and it's new
features.
I am not a psecialiste of OOP (only been OOPing for 2 month)
For a moment i tought that __set would allow me not to have to define a
methode __set that would set a value to a member variable.
It seems like we have to define the class __set and __get.
for example i tought i would be able to do.
class a{
function __construct(){
$this->__set("var_name1","value1");
$this->__set("var_name2","value2");
}
}
I read these 2 tutorial
http://www.phpbuilder.com/columns/argerich20030411.php3?page=5
(the
explanation seems really bad to me and does not show any usefull way to
use these functions)
http://talks.php.net/show/php5intro/25
This one well i comes back to the same thing as if i code it my self.
So my big question is why , when , how do we use these features
(__get,__set)
For a moment i tought i would save me time, but if i have to redefine
them what is the point ?
I guess i am somewhat confuse on this issue, any explanation would be
appreciated.
Thanks
--
Yann Larrivee <yannl@istop.com>