instanceof is used to determine whether a PHP variable is an instantiated object of a certain class.
<?phpclass MyClass{}class NotMyClass{}$a = new MyClass;var_dump($a instanceof MyClass);var_dump($a instanceof NotMyClass);?>
<?php
class MyClass
{
}
class NotMyClass
$a = new MyClass;
var_dump($a instanceof MyClass);
var_dump($a instanceof NotMyClass);
?>
output:
bool(true)bool(false)