Itay Moav -Malimovka
Itay Moav -Malimovka

Reputation: 53606

How to define a general method / catch it all method for an object?

On the same concept for object members, I can define generic __get and __set.
How do I do the same for methods?

class a{
  public method __general(){
  }


  public function b(){}
}

$r= new a();
$r->b(); //will use existing method
$r->baba()//will call __general()
$r->p()//will call __general()

You r more than welcome editing my language, if u understand what I meant.

Upvotes: 0

Views: 33

Answers (1)

hynner
hynner

Reputation: 1352

Use __call or __callStatic magic methods.

Check out documentation

Upvotes: 3

Related Questions