note 70908 added to function.get-defined-vars
| From: | william at avianhosting dot com | Date: | Fri, 03 Nov 2006 20:41:09 +0000 |
| Subject: | note 70908 added to function.get-defined-vars | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119348@lists.php.net to get a copy of this message | ||
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);.
----
Server IP: 66.207.199.35
Probable Submitter: 142.177.45.4
----
Manual Page -- http://www.php.net/manual/en/function.get-defined-vars.php
Edit -- https://master.php.net/note/edit/70908
Del: integrated -- https://master.php.net/note/delete/70908/integrated
Del: useless -- https://master.php.net/note/delete/70908/useless
Del: bad code -- https://master.php.net/note/delete/70908/bad+code
Del: spam -- https://master.php.net/note/delete/70908/spam
Del: non-english -- https://master.php.net/note/delete/70908/non-english
Del: in docs -- https://master.php.net/note/delete/70908/in+docs
Del: other reasons-- https://master.php.net/note/delete/70908
Reject -- https://master.php.net/note/reject/70908
Search -- https://master.php.net/manage/user-notes.php