note 106728 deleted from function.get-defined-vars by tularis
| From: | tularis@php.net | Date: | Fri, 02 Dec 2011 11:35:35 +0000 |
| Subject: | note 106728 deleted from function.get-defined-vars by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-184852@lists.php.net to get a copy of this message | ||
Note Submitter: cuisdy at gmail dot com
----
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
)