Skip to content

Instantly share code, notes, and snippets.

@chaitanyakuber
Last active December 17, 2015 18:49
Show Gist options
  • Save chaitanyakuber/5655854 to your computer and use it in GitHub Desktop.
Save chaitanyakuber/5655854 to your computer and use it in GitHub Desktop.
ooh, can use __call in php to catch missing methods, great pattern when refactoring
class foo
{
public function __call($name, $arguments)
{
// Note: value of $name is case sensitive.
echo "Calling object method '$name' "
. implode(', ', $arguments). "\n";
}
public function hello()
{
echo "hello";
}
}
$f = new foo();
$f->getLost();
$f->hello();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment