# Unset semantic on instance var

- Thread: https://externals.io/message/44987
- Original archive: https://news-web.php.net/php.internals/44987
- Started by Mathieu Suen on 2009-07-16T15:59:37+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #44987 — Mathieu Suen — 2009-07-16T15:59:37+00:00

URL: https://externals.io/message/44987#44987

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
