Re: How can I do the opposite of property_exists(), maybe a creat_property() in PHP5?

From: Date: Tue, 03 Feb 2009 21:58:20 +0000
Subject: Re: How can I do the opposite of property_exists(), maybe a creat_property() in PHP5?
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-287584@lists.php.net to get a copy of this message
the question is what is __set() doing, if it's throwing an exception for undefined properties then obviously it with 'blow up'.
But why should __set() even be called if I'm accessing the property directly? This seems stupid. $this->oraclecustomerid = 1122; should NOT be the same as $this->set_oraclecustomerid(1122); The second one I agree should call __set(), but the first one should NOT be triggering __call() or __set()
Yes it should. http://www.php.net/manual/en/language.oop5.overloading.php#language.oop5.overloading.members __set() is run when writing data to inaccessible members. if it's a protected/private variable, it'll call __set. If it's a variable that doesn't exist, it'll call __set. -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#287584) next »