note 74609 added to function.unset

From: Date: Thu, 19 Apr 2007 21:13:50 +0000
Subject: note 74609 added to function.unset
Groups: php.notes 
Request: Send a blank email to php-notes+get-125578@lists.php.net to get a copy of this message
well perhaps you cannot unset() a referenced variable like... <?php function foo(&$bar) { unset($bar); $bar = "blah"; } $bar = 'something'; echo "$bar\n"; foo($bar); echo "$bar\n"; ?> Output something something ...but you can like this... <?php function foo(&$bar) { unset($$bar); <- dereference the var $bar = "blah"; } $bar = 'something'; echo "$bar\n"; foo($bar); echo "$bar\n"; ?> Output something bar food for thought... - mark ---- Server IP: 69.39.81.135 Probable Submitter: 65.201.56.133 ---- Manual Page -- http://www.php.net/manual/en/function.unset.php Edit -- https://master.php.net/note/edit/74609 Del: integrated -- https://master.php.net/note/delete/74609/integrated Del: useless -- https://master.php.net/note/delete/74609/useless Del: bad code -- https://master.php.net/note/delete/74609/bad+code Del: spam -- https://master.php.net/note/delete/74609/spam Del: non-english -- https://master.php.net/note/delete/74609/non-english Del: in docs -- https://master.php.net/note/delete/74609/in+docs Del: other reasons-- https://master.php.net/note/delete/74609 Reject -- https://master.php.net/note/reject/74609 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#125578) next »