Overriding Scope with the GLOBALS Array : GLOBALS « Language Basics « PHP






Overriding Scope with the GLOBALS Array

 
function foo( ) {
            $GLOBALS['bar'] = "wombat";
    }

    $bar = "baz";
    foo( );
    print $bar;
  
  








Related examples in the same category

1.Set new value into GLOBALS values
2.Looping Through the $GLOBALS Array
3.$GLOBALS with property
4.Accessing Global Variables with the global Statement
5.Create global variables
6.Modifying a Variable with $GLOBALS
7.Global vs function level