PHP.nl

method_exists

method_exists

Checks if the class method exists

bool **method_exists**  $object_or_class string $method

Checks if the class method exists in the given . object_or_class

object_or_classAn object instance or a class name

methodThe method name

Returns true if the method given by has been defined for the given , false otherwise. method``object_or_class

Voorbeeld: example

<?php
$directory = new Directory('.');
var_dump(method_exists($directory,'read'));
?>
bool(true)

Voorbeeld: Static example

<?php
var_dump(method_exists('Directory','read'));
?>
bool(true)

Opmerking: > The function cannot detect methods that are magically accessible using the

magic method.

method_exists__call

function_exists``is_callable``class_exists