update : 2015.11.03
php.shukuma.com

검색:
 
 
Checks class for instance

ReflectionClass::isInstance

(PHP 5)

ReflectionClass::isInstanceChecks class for instance

설명

public bool ReflectionClass::isInstance ( object $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

참고