fork download
  1. <?php
  2.  
  3. class a
  4. {
  5. public function b() {}
  6. }
  7.  
  8. class c extends a
  9. {
  10. public function b() {}
  11. }
  12.  
  13. $class = new ReflectionClass('c');
  14.  
  15. $method = $class->getMethod('b');
  16.  
  17. var_dump($method->getDeclaringClass()->getName());
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
string(1) "c"