Be aware of what get_defined_vars() function returns in different contexts:
- In global scope, a list of all defined variables, whether superglobals, command line arguments or user-defined variables
- In function scope, only a list of user-defined variables (both arguments and in-body definitions)
- In class/object method scope, does not return class/object properties;
Also, as of PHP 5.4, does not return $_ENV even where available.
For further details and scope tests/results, see https://github.com/php/doc-en/issues/1317