English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP Class/Object function reference manual
The method_exists() function checks if the class method exists
method_exists($object, $method_name);
It checks if the class method exists in the given object.
Serial number | Parameters and descriptions |
---|---|
1 | object(Required) Object to be tested |
2 | mthod_name(Required) Method name. |
If the method with the given method_name is defined for the given object, it returns TRUE, otherwise it returns FALSE.
The following is the usage of this function-
<?php $directory = new Directory('.'); var_dump(method_exists($directory,'anything')); ?>Test to see‹/›
It will produce the following result-
bool(false)