If I call $object->showSomething()
and the showSomething
method doesn't exist I get a fata error. That's OK.
But I have a show()
method that takes a argument. Can I somehow tell PHP to call show('Something');
when it encounters $object->showSomething()
?
Try something like this:
Output:
StuffMoreStuff and me tooEvenMoreStuff
You can use the function method_exists(). Example:
Not necessarily just the
show....
methods, but any method, yes, use __call. Check for the method asked in the function itself.