(PHP 5)
ReflectionClass::isInstance — Checks class for instance
Checks if an object is an instance of a class.
The object being compared to.
成功した場合に TRUE を、失敗した場合に FALSE を返します。
例1 ReflectionClass::isInstance related examples
<?php
// Example usage
$class = new ReflectionClass('Foo');
if ($class->isInstance($arg)) {
echo "Yes";
}
// Equivalent to
if ($arg instanceof Foo) {
echo "Yes";
}
// Equivalent to
if (is_a($arg, 'Foo')) {
echo "Yes";
}
?>
上の例の出力は、 たとえば以下のようになります。
Yes Yes Yes