Home > PHP > Function > Classes/Objects > method_exists()

method_exists()

method_exists - Checks if the class method exists

Syntax

bool method_exists (mixed $object, string $method_name)

Arguments

  • object - An object instance or a class name
  • method_name - The method name

Description

Checks if the class method exists in the given object.

Version

PHP 4, 5

Return value

Returns TRUE if the method given by method_name has been defined for the given object, FALSE otherwise.