How do i get all defined vars inside a class like if it was called outside the class scope? When i call the function inside a class method i only get an empty object.
sorry maybe i had explain it wrong, i meant the wide site vars, like if get_defined_vars() was called in the main script.
markcial
2010-03-24 08:54:50
I'm not aware of that being possible, because every function / method makes own scope. get_defined_vars() does return the variables defined in your class method, if you have any, but this is not helping you.
jholster
2010-03-24 09:17:51
+5
A:
via => http://stackoverflow.com/questions/2505735/define-variables-outside-the-php-class
class Foo {
function bar(){
var_dump($GLOBALS);
}
}
Foo::bar();
outputs :
array(8) {
["GLOBALS"]=>
array(8) {
["GLOBALS"]=>
*RECURSION*
["_POST"]=>
array(0) {
}
/*snip*/
markcial
2010-03-24 08:53:13