I thought this will work but it didn’t.
class Foo {
public function send($to, $message)
{
echo 'sending';
}
public static function __callStatic($method, $params)
{
return call_user_func_array(array(new static, $method), $params);
}
}
When I do Foo::send('mary','you had a little lamb'), why is it still calling Foo::send() instead of new Foo ->send($to, $message)?
Non-static method Foo::send() should not be called statically, assuming $this from incompatible context
According to the manual:
Your method is not inaccessible, it exists and is accessible, it is just not static.