note 12689 deleted from language.variables.scope by jimw
| From: | jimw@php.net | Date: | Sat, 08 Dec 2001 21:45:46 +0000 |
| Subject: | note 12689 deleted from language.variables.scope by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22233@lists.php.net to get a copy of this message | ||
I wanted to use functions to make my code cleaner, but in these functions I also wanted to use a lot
of global variables. First I did this:
function foo() {
global $bar, $baz, $fubar, $boo, $bop ... ;
echo $bar;
// ...
}
Not very nice.
Then I did this:
function foo() {
extract ($GLOBALS);
echo $bar;
// ...
}
Neat! This even works across includes, of course.