Syntax
is_a ( $object, $class_name ) |
Definition and Usage
Checks if the given object is of this class or has this class as one of its parents.
Paramters
Parameter | Description |
---|---|
object | Required. The tested object |
class | Required. The class name. |
Return Value
Returns TRUE if the object is of this class or has this class as one of its parents, FALSE otherwise.
Example
Following is the usage of this function:
<?php class WidgetFactory { var $oink = 'moo'; } // create a new object $WF = new WidgetFactory(); if (is_a($WF, 'WidgetFactory')) { echo "yes, \$WF is still a WidgetFactory"; } ?> |
It will produce following result:
yes, $WF is still a WidgetFactory |
No comments:
Post a Comment