So, method_exists()
requires an object to see if a method exists. But I want to know if a method exists from within the same class.
I have a method that process some info and can receive an action, that runs a method to further process that info. I want to check if the method exists before calling it. How can I achieve it?
Example:
class Foo{
public function bar($info, $action = null){
//Process Info
$this->$action();
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…