Php/docs/reflectionclass.getinterfaces

提供:Dev Guides
< Php
移動先:案内検索

ReflectionClass::getInterfaces

(PHP 5, PHP 7)

ReflectionClass::getInterfacesインターフェイスを取得する


説明

public ReflectionClass::getInterfaces ( ) : array

インターフェイスを取得します。


パラメータ

この関数にはパラメータはありません。


返り値

インターフェイスの連想配列を返します。インターフェイス名が連想配列のキー、対応する値が ReflectionClass オブジェクトとなります。


例1 ReflectionClass::getInterfaces() の例

<?phpinterface Foo { }interface Bar { }class Baz implements Foo, Bar { }$rc1 = new ReflectionClass("Baz");print_r($rc1->getInterfaces());?>

上の例の出力は、 たとえば以下のようになります。


Array
(
    [Foo] => ReflectionClass Object
        (
            [name] => Foo
        )

    [Bar] => ReflectionClass Object
        (
            [name] => Bar
        )

)

参考