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

ReflectionClass::getInterfaceNames

PHP function Edit on GitHub ✎

(PHP 5 >= 5.2.0, PHP 7, PHP 8)

Gets the interface names

Description

ReflectionClass::getInterfaceNames(): array

Get the interface names.

Parameters Parameters

Return Values

A numerical array with interface names as the values.

Examples

ReflectionClass::getInterfaceNames example

php
<?php
interface Foo { }

interface Bar { }

class Baz implements Foo, Bar { }

$rc1 = new ReflectionClass("Baz");

print_r($rc1->getInterfaceNames());
?>

The above example will output something similar to:

output
Array
(
    [0] => Foo
    [1] => Bar
)

See Also

  • ReflectionClass::getInterfaces

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