method_exists
method_exists — クラスメソッドが存在するかどうかを確認する
説明
bool method_exists ( object object, string method_name )指定した object にクラスメソッドが存在するかどうかを調べます。
パラメータ
- object
-
オブジェクトのインスタンス。
- method_name
-
メソッドの名前。
返り値
method_name で指定したメソッドが 指定した object において定義されている場合に TRUE、そうでない場合に FALSE を返します。例
例 361. method_exists() の例
<?php
$directory = new Directory('.');
var_dump(method_exists($directory,'read'));
?>
上の例の出力は以下となります。bool(true)
参考
function_exists() |
is_callable() |
Weblioに収録されているすべての辞書からmethod_existsを検索する場合は、下記のリンクをクリックしてください。

- method_existsのページへのリンク