[wp-hackers] Globalize everything

Andy Skelton skeltoac at gmail.com
Thu Dec 6 21:26:43 GMT 2007


Don't you hate it when you forget to "global $wpdb;"? Here is a solution:

<?php
$a = 'Andy';
function g() {
	return 'foreach(array_keys($GLOBALS) as $g)global $$g;unset($g);';
}
function go() {
	eval(g());
	var_dump($a);
}
go();
?>

Andy

(Sorry, couldn't wait for April.)


More information about the wp-hackers mailing list