(PHP 5, PHP 7)
ReflectionClass::isInstance — Checks class for instance
$object
)Checks if an object is an instance of a class.
object
The object being compared to.
성공 시 TRUE
를, 실패 시 FALSE
를 반환합니다.
Example #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