interface_exists
interface_exists — インターフェースが宣言されているかどうかを確認する
説明
bool interface_exists ( string interface_name [, bool autoload] )指定したインターフェイスが定義されているかどうかを調べます。
パラメータ
- interface_name
-
インターフェイス名。
- autoload
-
デフォルトで __autoload をコールするかどうか。
返り値
interface_name で与えられたインターフェースが宣言されていれば TRUE を返します。 そうでなければ FALSE を返します。例
例 357. interface_exists() の例
<?php
// 使用する前にインターフェースが存在するかどうかを確認する
if (interface_exists('MyInterface')) {
class MyClass implements MyInterface
{
// メソッド
}
}
?>
参考
class_exists() |
Weblioに収録されているすべての辞書からinterface_existsを検索する場合は、下記のリンクをクリックしてください。

- interface_existsのページへのリンク