SunshinePHP Developer Conference 2015

ReflectionClass::isInstance

(PHP 5)

ReflectionClass::isInstanceبررسی کلاس برای نمونه

Description

public bool ReflectionClass::isInstance ( object $object )

بررسی نمونه بودن از شی.

Parameters

object

شی برای مقایسه.

Return Values

Returns TRUE on success or FALSE on failure.

Examples

Example #1 مثال مرتبط ReflectionClass::isInstance()

<?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";
}
?>

The above example will output something similar to:

Yes
Yes
Yes

See Also

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top