tags:

views:

47

answers:

2

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.

A: 

get_class_vars() maybe?

jholster
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
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
+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