Global Variable scope within functions
| From: | Paul S. Gumerman | Date: | Wed, 10 May 2000 04:43:35 +0000 |
| Subject: | Global Variable scope within functions | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-14706@lists.php.net to get a copy of this message | ||
To the PHP4 developer gurus:
Is there any undocumented feature that would make it possible to have a
function with ALL global variables in its scope?
The equivalent to this:
function foo {
for (reset($GLOBALS); $Gvn = key($GLOBALS); next($GLOBALS))
global $$Gvn;
....
}
Which does work, but I fear is fairly expensive.
If not, would it be possible to write an extension function, that when
called inside a PHP function, set the variable scope back to global? Do
you have any hints as to how to go about it? I've already written one
extension function, so if you speak real slow, and use very small words,
I might, just maybe, get the ZEND API stuff that I know would be
involved <g>....
(Just as an aside, this would be REAL nice to have available in PHP)
global function foo {
....
}
Thanks for any pointers you all may send my way,
Paul
-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com