note 47157 added to function.unset
| From: | danAT--nospam--cubelandDOTcoDOTuk at osu1 dot php dot net | Date: | Thu, 04 Nov 2004 19:38:03 +0000 |
| Subject: | note 47157 added to function.unset | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-79634@lists.php.net to get a copy of this message | ||
dh at argosign dot de -
it is possible to unset globals from within functions thanks to the $GLOBALS array:
<?php
$x = 10;
function test() {
// don't need to do ' global $x; '
unset ($GLOBALS['x']);
echo 'x: ' . $GLOBALS['x'] . '<br />';
}
test();
echo "x: $x<br />";
// will result in
/*
x:
x:
*/
?>
----
Manual Page -- http://www.php.net/manual/en/function.unset.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+47157
Delete -- http://master.php.net/manage/user-notes.php?action=delete+47157&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47157&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47157&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47157&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47157&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47157&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+47157&report=yes
Search -- http://master.php.net/manage/user-notes.php