note 96430 added to function.unset

From: Date: Fri, 26 Feb 2010 16:55:39 +0000
Subject: note 96430 added to function.unset
Groups: php.notes 
Request: Send a blank email to php-notes+get-166400@lists.php.net to get a copy of this message
Note that PHP 4 will generate a warning if you try to unset an array index that doesn't exist and whose parent doesn't exist. Example: <?php $foo = array(); unset($foo['Bar']['Baz']); ?> RESULT: "Notice: Undefined index: Bar" On PHP5 no error is raised, which seems to me like the correct behaviour. Note that using unset($foo['Bar']) in the above example does not generate a warning in either version. (Tested on 4.4.9 and 5.2.4) ---- Server IP: 78.110.173.36 Probable Submitter: 62.56.63.0 ---- Manual Page -- http://www.php.net/manual/en/function.unset.php Edit -- https://master.php.net/note/edit/96430 Del: integrated -- https://master.php.net/note/delete/96430/integrated Del: useless -- https://master.php.net/note/delete/96430/useless Del: bad code -- https://master.php.net/note/delete/96430/bad+code Del: spam -- https://master.php.net/note/delete/96430/spam Del: non-english -- https://master.php.net/note/delete/96430/non-english Del: in docs -- https://master.php.net/note/delete/96430/in+docs Del: other reasons-- https://master.php.net/note/delete/96430 Reject -- https://master.php.net/note/reject/96430 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#166400) next »