Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $foo = 1;
- function meh(){
- // <-- $foo can't be accessed
- }
- <?php
- $a = 1;
- $b = 2;
- function Sum()
- {
- global $a, $b;
- $b = $a + $b;
- }
- ?>
- <?php
- $a = 1;
- $b = 2;
- function Sum()
- {
- $GLOBALS['b'] = $GLOBALS['a'] + $GLOBALS['b'];
- }
- ?>
- <?php
- $foo = 1;
- function meh(){
- global $foo;
- // <-- $foo now can be accessed
- }
- ?>
- function meh(){
- global $foo;
- // $foo now exists in this scope
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement