Guest User

Untitled

a guest
Jun 21st, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. function is_class_a($a, $b)
  2. {
  3. return $a == $b || is_subclass_of($a, $b);
  4. }
  5.  
  6. <?php
  7.  
  8. class a{}
  9.  
  10. class b extends a{}
  11.  
  12. $r = new ReflectionClass( 'b' );
  13.  
  14. echo "class b "
  15. , (( $r->isSubclassOf( new ReflectionClass( 'a' ) ) ) ? "is" : "is not")
  16. , " a subclass of a";
Add Comment
Please, Sign In to add comment