class Hello
{
// ...
public function __call($name, $args)
{
$methods = get_class_methods($this);
if (!in_array($name, $methods)) throw new BadMethodCallException("Method $name not found.");
}
}
try {
$f->remember('My Friend'); // method doest exist
$f->say();
} catch(Exception $e) {
die($e->getMessage());
}