Voting

: six minus two?
(Example: nine)

The Note You're Voting On

magnesium dot oxide dot play+php at gmail dot com ΒΆ
11 years ago
You can unset superglobals like $GLOBALS, $_GET etc., but causing an unususal behavior (as of PHP 5.3.3).

1) unsetting of superglobals is done globally, i.e. unsetting inside the function affects GLOBALLY.

2) Recreation of unset'ed superglobals can be done (recreated valiables are superglobals), but original functionality (in $GLOBALS, $_SESSION ...) has lost.

<?php

function foo(){
unset(
$GLOBALS);
}

function
bar(){
var_dump($GLOBALS);
}

foo();
bar(); //issues E_NOTICE ($GLOBALS not defined)
$GLOBALS=3;
bar(); //displays int(3)

?>

<< Back to user notes page

To Top