English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP Class/Object function reference manual
Returns TRUE if the object belongs to this class or this class is the parent class of the object
is_a($object, $class_name)
Check if the given object belongs to this class or if this class is one of the parent classes of the object.
Number | Parameters and descriptions |
---|---|
1 | object (required) Object to be tested |
2 | class (required) Class name. |
Returns TRUE if the object belongs to this class or if this class is one of the parent classes of the object, otherwise returns FALSE.
Here is the usage of this function-
<?php if ($wid_fact instanceof WidgetFactory) { echo 'Yes, $wid_fact is a WidgetFactory'; } ?>
It will produce the following result-
Yes, $WF is a WidgetFactory
In PHP 5 Using the instanceof operator
<?php if ($WF instanceof WidgetFactory) { echo 'Yes, $WF is a WidgetFactory'; } ?>