note 70908 deleted from function.get-defined-vars by danbrown

From: Date: Fri, 06 Feb 2009 00:53:01 +0000
Subject: note 70908 deleted from function.get-defined-vars by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-150280@lists.php.net to get a copy of this message
Note Submitter: william at avianhosting dot com ---- In response to sijmen at digitized dot nl and similar questions -- the problem is variable scope. $GLOBALS is used to access variables in the global scope from inside a function -- this is expected behavior, as get_defined_vars(); is supposed to get the -defined- variables -- and by default, variables in the global scope are -not- defined in the function scope. Therefore, if you want the variables from the global scope -- print_r($GLOBALS);.

« previous php.notes (#150280) next »