note 39373 added to function.unset

From: Date: Mon, 26 Jan 2004 14:51:35 +0000
Subject: note 39373 added to function.unset
Groups: php.notes 
Request: Send a blank email to php-notes+get-64203@lists.php.net to get a copy of this message
on the comment by dh at argosign dot de it IS possible to unset global variables out of a function, you just have to use the superglobe $GLOBALS here the code corrected so it would work! <?php $x = 10; function test() { unset ($GLOBALS['x']); echo "x: $x<br>"; } test(); echo "x: $x<br>"; ?> the examlpe would give the result x: x: now, and depending on the error_report level notices about undefined variables! ---- Manual Page -- http://www.php.net/manual/en/function.unset.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39373 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39373&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39373&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#64203) next »