- is_callable: documentation ( source)
<?php
class Foo
{
public $hello;
public function __construct()
{
$this->hello = function(){
echo 'hello from callable';
};
}
public function __call($method, $args)
{
if(is_callable(array($this, $method))) {
return call_user_func_array($this->$method, $args);
}
}
}
$foo = new Foo();
$foo->hello();