is_a
Function • Params and return types changed in PHP 8.0
Checks whether the object is of a given type or subtype.
is_a
Function synopsis
is_a(
mixed $object_or_class,
string $class,
bool $allow_string = false
): bool
Parameters
$object_or_class
Typemixed
A class name or an object instance.
$class
Typestring
The class or interface name
$allow_string
OptionalTypebool
Default valuefalse
If this parameter set to false
, string class name as $object_or_class
is not allowed. This also prevents from calling autoloader if the class doesn't exist.
Return value
Typebool
Returns true
if $object_or_class
is the
$class
object type,
or has $class
as one of its supertypes, false
otherwise.
Changes to the is_a
Function
PHP 8.0
- Return type added:
bool
- Parameter name of parameter #1 changed:
$object
to$object_or_class
- Parameter type added for parameter #1 (
$object_or_class
):mixed
- Parameter name of parameter #2 changed:
$class_name
to$class
- Parameter type added for parameter #2 (
$class
):string
- Parameter type added for parameter #3 (
$allow_string
):bool
- Parameter default value added for position #3 (
$allow_string
):false
is_a(
- $object,
+ mixed $object_or_class,
- $class_name,
+ string $class,
- $allow_string
+ bool $allow_string = false
- )
+ ): bool
PHP 5.4
- Optional parameter added - #3:
$allow_string
-is_a($object, $class_name)
+is_a(
+ $object,
+ $class_name,
+ $allow_string
+ )
is_a
Function Availability
is_a
Function AvailabilityPHP Version | Availability |
---|---|
PHP 8.5Future Release | Yes |
PHP 8.4Upcoming Release | Yes |
PHP 8.3Supported (Latest) | Yes |
PHP 8.2Supported | Yes |
PHP 8.1Security-Fixes Only | Yes |
PHP 8.0Unsupported | Yes |
PHP 7.4Unsupported | Yes |
PHP 7.3Unsupported | Yes |
PHP 7.2Unsupported | Yes |
PHP 7.1Unsupported | Yes |
PHP 7.0Unsupported | Yes |
PHP 5.6Unsupported | Yes |
PHP 5.5Unsupported | Yes |
PHP 5.4Unsupported | Yes |
PHP 5.3Unsupported | Yes |