Check if a Function exists within a Class [PHP]
Posted by Chad Ayers on June 4, 2010
Comments Off
The following code returns a bool value of true or false:
<?
class Books
{
public function read()
{
}
public function find()
{
}
}
$class = new Books();
$function = "find";
$methodVariable = array($class, $function);
$function_exists = var_dump(is_callable($methodVariable));
echo $function_exists;
?>
Live example of above code.
