note 98536 deleted from function.unset by danbrown

From: Date: Fri, 25 Jun 2010 15:21:20 +0000
Subject: note 98536 deleted from function.unset by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-170454@lists.php.net to get a copy of this message
Note Submitter: Hayley Watson ---- If you list several variables at once in the unset(), they will be unset in the order that you list them: <?php unset($a, $b, $c); ?> is exactly the same as <?php { unset($a); unset($b); unset($c); } ?> They are not (at least for now) all unset at the same time. So the following code does NOT unset $array['bar'] and leave $array empty: <?php $foo = 'bar'; $array = array('bar'=>17); unset($foo, $array[$foo]); print_r($array); ?> Instead it triggers a Notice about an undefined variable $foo, and leaves $array unchanged.

« previous php.notes (#170454) next »