[wp-hackers] Variable Scope

Andy Skelton skeltoac at gmail.com
Tue Mar 11 02:03:39 GMT 2008


On Mon, Mar 10, 2008 at 8:39 PM, Chris Poteet <cpoteet at siolon.com> wrote:
> I want to have a wider scope for variables in my plugin, but for some
>  reason it's not working.  For instance:

A common problem with core hacking is the crazy number of globals. To
get around this, it would be better to call this at the beginning of
every function:

eval(G());

function G() {
return 'foreach (array_keys($GLOBALS) as $global ) global $$global;';
}

Enjoy ;-)

Andy

(Sorry, couldn't wait for April Fool's Day!)


More information about the wp-hackers mailing list