Advertisement
zero50x

ООП Вытащить имена всех подклассов

Nov 1st, 2016
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.22 KB | None | 0 0
  1. class Foo {}
  2. class Boo extends Foo {}
  3. class Bar extends Foo {}
  4.  
  5. $children = [];
  6. foreach( get_declared_classes() as $class ) {
  7.     if( is_subclass_of( $class, 'Foo' ) ) {
  8.         $children[] = $class;
  9.     }
  10. }
  11. print_r($children);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement