HosipLan

Untitled

May 10th, 2012
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.33 KB | None | 0 0
  1.  
  2. function get_cc()
  3. {
  4.     foreach (debug_backtrace() as $call) {
  5.         if (!isset($call['class'])) {
  6.             continue;
  7.         }
  8.         return $call['class'];
  9.     }
  10.  
  11. }
  12.  
  13.  
  14.  
  15. class Foo
  16. {
  17.    
  18.     public function bar()
  19.     {
  20.         dump(get_cc());
  21.     }
  22.  
  23.     public static function baz()
  24.     {
  25.         dump(get_cc());
  26.     }
  27.  
  28. }
  29.  
  30.  
  31. $foo = new Foo;
  32. $foo->bar();
  33.  
  34. Foo::baz();
Advertisement
Add Comment
Please, Sign In to add comment