note 98536 added to function.unset

From: Date: Mon, 21 Jun 2010 23:53:27 +0000
Subject: note 98536 added to function.unset
Groups: php.notes 
Request: Send a blank email to php-notes+get-170356@lists.php.net to get a copy of this message
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. ---- Server IP: 69.147.83.197 Probable Submitter: 219.89.233.43 ---- Manual Page -- http://www.php.net/manual/en/function.unset.php Edit -- https://master.php.net/note/edit/98536 Del: integrated -- https://master.php.net/note/delete/98536/integrated Del: useless -- https://master.php.net/note/delete/98536/useless Del: bad code -- https://master.php.net/note/delete/98536/bad+code Del: spam -- https://master.php.net/note/delete/98536/spam Del: non-english -- https://master.php.net/note/delete/98536/non-english Del: in docs -- https://master.php.net/note/delete/98536/in+docs Del: other reasons-- https://master.php.net/note/delete/98536 Reject -- https://master.php.net/note/reject/98536 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#170356) next »