Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function is_class_a($a, $b)
- {
- return $a == $b || is_subclass_of($a, $b);
- }
- <?php
- class a{}
- class b extends a{}
- $r = new ReflectionClass( 'b' );
- echo "class b "
- , (( $r->isSubclassOf( new ReflectionClass( 'a' ) ) ) ? "is" : "is not")
- , " a subclass of a";
Add Comment
Please, Sign In to add comment