Check if the class method exists in PHP

You can simply use the built-in function method_exists() and it will return a boolean true if it exists and false if it doesn’t.

Example Usage:

$class_obj = new ClassName();
var_dump( method_exists($class_obj, 'myMethodName') );

Example Output:

bool(true)