Skip to content

Instantly share code, notes, and snippets.

@jwigal
Created January 31, 2014 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwigal/8740536 to your computer and use it in GitHub Desktop.
Save jwigal/8740536 to your computer and use it in GitHub Desktop.
global scope isn't global any more...
<?php
$global1 = "boo!";
function outer(){
global $global1;
$global2 = "ya!";
echo "<p>outer says global1 is $global1</p>";
function inner(){
global $global1, $global2;
echo "<p>inner says global1: $global1, global2: $global2</p>";
}
inner();
}
outer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment