Home >Backend Development >PHP Tutorial >PHP functions: method_exists and function_exists_PHP tutorial
Check whether the class method exists
<span 1</span> bool <span method_exists</span> ( <span mixed</span> <span $object</span> , <span string</span> <span $method_name</span> )
Check whether the method of the class exists in the specified object
object: object example or class name
method_name: method name
If the method pointed by method_name has been defined in the object class pointed by object, return TRUE, otherwise return FALSE.
If this class is not a known class, using this function will use any registered autoloader.
If the provided method has been defined, return TRUE.
<span 1</span> bool <span function_exists</span> ( <span string</span> <span $function_name</span> )
Check the list of defined methods, both built-in (inside PHP) and user-defined.
Method name, string type.
When the method name exists and is a method, return TRUE, otherwise return FALSE.
This function will return FALSE
for constructs, such as include_once and echo.