Query: is_a
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
IS_A(3) 1 IS_A(3) is_a - Checks if the object is of this class or has this class as one of its parentsSYNOPSISbool is_a FALSE (object $object, string $class_name, [bool $allow_string])DESCRIPTIONChecks if the given $object is of this class or has this class as one of its parents.PARAMETERSo $object - The tested object o $class_name - The class name o $allow_string - If this parameter set to FALSE, string class name as $object is not allowed. This also prevents from calling autoloader if the class doesn't exist.RETURN VALUESReturns TRUE if the object is of this class or has this class as one of its parents, FALSE otherwise.CHANGELOG+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.9 | | | | | | | Added $allow_string parameter | | | | | 5.3.0 | | | | | | | This function is no longer deprecated, and will | | | therefore no longer throw E_STRICT warnings. | | | | | 5.0.0 | | | | | | | This function became deprecated in favour of the | | | instanceof operator. Calling this function will | | | result in an E_STRICT warning. | | | | +--------+---------------------------------------------------+EXAMPLESExample #1 is_a(3) example <?php // define a class class WidgetFactory { var $oink = 'moo'; } // create a new object $WF = new WidgetFactory(); if (is_a($WF, 'WidgetFactory')) { echo "yes, $WF is still a WidgetFactory "; } ?> Example #2 Using the instanceof operator in PHP 5 <?php if ($WF instanceof WidgetFactory) { echo 'Yes, $WF is a WidgetFactory'; } ?>SEE ALSOget_class(3), get_parent_class(3), is_subclass_of(3). PHP Documentation Group IS_A(3)
Related Man Pages |
---|
simplexml_load_file(3) - php |
spl_autoload_register(3) - php |
class_implements(3) - php |
get_parent_class(3) - php |
get_class_vars(3) - php |
Similar Topics in the Unix Linux Community |
---|
create object |
POP 3 client class 2008.01.08 (Default branch) |
SJS PHP Class: Release 1.0 |
How to "ignore" deprecates in php? |
Printing class address! |