|
<?php
class A { }
class B { }
$thing = new A;
if ($thing instanceof A) {
echo 'A';
}
if ($thing instanceof B) {
echo 'B';
}
?> |
As $thing is an object of type A, but not B, only the block dependent on the A type will be executed:
A |
See also get_class() and is_a().
