Hi all, here is the code I am having problem with:

============================================

class baseForm {
   private $_id = 10;

   function __get($member)
   {
       echo "Accessing member \"{$member}\" : <br />\n";
       return $this->$member;
   }
   function checkID()
   {
       echo $this->_id."<br />\n";
   }
}
class inputText extends baseForm
{
   function display()
   {
       $this->checkID();
       echo $this->_id."<br />\n";
   }
}
$f = new inputText();
echo $f -> display();


============================================


The question is: why the string 'Accessing member "_id" :' is only displayed once? If you look at the code - it actually accesses $_id member TWICE. But __get() gets gets triggered only once. WHY?!!

From what I see, the __get() accessor function is triggerred only from OUTSIDE the class.

PHP Version 5.1.6, installed on Win32 (unfortunately).

Thank you in advance,
Temuri

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to