If the target class has __call() magic function implemented, then is_callable will ALWAYS return TRUE for whatever method you call it.
is_callable does not evaluate your internal logic inside __call() implementation (and this is for good).
Therefore every method name is callable for such classes.
Hence it is WRONG to say (as someone said):
...is_callable will correctly determine the existence of methods made with __call...
Example:
<?php
class TestCallable
{
public function testing()
{
return "I am called.";
}
public function __call($name, $args)
{
if($name == 'testingOther')
{
return call_user_func_array(array($this, 'testing'), $args);
}
}
}
$t = new TestCallable();
echo $t->testing(); echo $t->testingOther(); echo $t->working(); echo is_callable(array($t, 'testing')); echo is_callable(array($t, 'testingOther')); echo is_callable(array($t, 'working')); ?>