php8.5
Home/ Manual/ reflection / reflectionclass/ ReflectionClass::isInterface

ReflectionClass::isInterface

PHP function Edit on GitHub ✎

(PHP 5, PHP 7, PHP 8)

Checks if the class is an interface

Description

ReflectionClass::isInterface(): bool

Checks whether the class is an interface.

Parameters Parameters

Return Values

Returns true if the class is an interface or false otherwise.

Examples

Basic usage of ReflectionClass::isInterface

php
<?php
interface SomeInterface {
    public function interfaceMethod();
}

$class = new ReflectionClass('SomeInterface');
var_dump($class->isInterface());
?>

The above example will output:

output
bool(true)

See Also

  • ReflectionClass::isInstance

Source: reference/reflection/reflectionclass/isinterface.xml · from the official PHP manual (php/doc-en)