Advertisement
Guest User

get_object_vars in self context

a guest
Aug 24th, 2015
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.30 KB | None | 0 0
  1. <?php
  2.  
  3. class A {
  4.     private $plop;
  5.  
  6.     function __construct() {
  7.         $this->plop = 'something private';
  8.     }
  9.  
  10.     static function test() {
  11.         $f = new A();
  12.         print_r(get_object_vars($f));
  13.         print_r(call_user_func('get_object_vars', $f));
  14.     }
  15. }
  16.  
  17. $a = new A();
  18. $a->test();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement