Unset semantic on instance var

From: Date: Thu, 16 Jul 2009 15:59:37 +0000
Subject: Unset semantic on instance var
Groups: php.internals 
Request: Send a blank email to internals+get-44987@lists.php.net to get a copy of this message
Hi, try: _______ class A { protected $a; public function __construct() {
       if(!isset($this->a))
       {
           $this->a = 'd';
echo '1st';
       }
       unset($this->a);
       if(!isset($this->a))
       {
           $this->a = 'g';
echo '2nd';
       }
}
    public function __set($columnName, $value)
    {
        echo 'New value : ' . $value . ' for '. $columnName;
    }
} new A(); ______ unset mean removing the instance variable from the class!! I was using the lazy initialisation with the isset function but then now I will initalize all inst var with null and check with the is_null function. Would it be possible to have inst var null by default insthead of a pseudo unset/null variable. Thanks Cheers - Mathieu Suen

« previous php.internals (#44987) next »