note 106728 added to function.get-defined-vars
| From: | cuisdy at gmail dot com | Date: | Fri, 02 Dec 2011 03:35:52 +0000 |
| Subject: | note 106728 added to function.get-defined-vars | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-184846@lists.php.net to get a copy of this message | ||
As of PHP 5.3.6 (5.3.6-13ubuntu3.2) it seems that get_defined_vars is NOT including variables in the
global scope when used inside a method or function.
<?php
$notSeen = 'this will not be listed';
function foo() {
$seen = 'bar';
print_r( get_defined_vars() );
}
foo();
?>
Outputs:
Array
(
[seen] => bar
)
----
Server IP: 69.147.83.197
Probable Submitter: 190.135.148.60
----
Manual Page -- http://www.php.net/manual/en/function.get-defined-vars.php
Edit -- https://master.php.net/note/edit/106728
Del: integrated -- https://master.php.net/note/delete/106728/integrated
Del: useless -- https://master.php.net/note/delete/106728/useless
Del: bad code -- https://master.php.net/note/delete/106728/bad+code
Del: spam -- https://master.php.net/note/delete/106728/spam
Del: non-english -- https://master.php.net/note/delete/106728/non-english
Del: in docs -- https://master.php.net/note/delete/106728/in+docs
Del: other reasons-- https://master.php.net/note/delete/106728
Reject -- https://master.php.net/note/reject/106728
Search -- https://master.php.net/manage/user-notes.php