How do you find a file to handle this?
How do you find a file to handle this?
I do not understand the question very well, but here's what is the function and how to use it.
The method_exists () function only checks if a method exists:
Description:
bool method_exists ( object $object , string $method_name )
true
if method was found and false
if not); Definition:
if(method_exists('MinhaClasse','MeuMetodo')) {
echo "existe";
} else {
echo "não existe";
}
Example :
<?php
$directory = new Directory('.');
var_dump(method_exists($directory,'read')); //retorna true pois existe o método read na classe de diretório
?>
the same can see it done like this:
<?php
var_dump(method_exists('Directory','read'));
?>
Example:
<?php
class A {
public function FUNC() {
echo '*****';
}
}
$a = new A();
$a->func(); // printa *****
var_dump(method_exists($a, 'func')); // retorna bool(true) pois existe tal método
?>
See more: PHP documentation: method_exists ()