This function Checks if the class method exists.

Syntax: method_exists ( object, string method_name )

Description:

This function returns TRUE if the method_name has been defined for the given object, FALSE otherwise.

Example:
Code:

  
class calculate
{
function add()
{}

}

$obj=new calculate;
if(method_exists($obj,add))
{
echo "add function is exist";

}
else
{
echo "add function is not exist";
}

Output:

add function is exist

eXTReMe Tracker