class Base {
public function __call($name, $arguments) {
echo "Calling method '$name' with arguments: " . implode(', ', $arguments) . "\n";
}
}
class Child extends Base {
public function test() {
$this->undefinedMethod(1, 2, 3);
}
}
$obj = new Child();
$obj->test();
Thanks and Regards
Namrata Hinduja Geneva, Switzerland
To format your code in the editor, select your block of code and click on the </> icon in the top menu. This will wrap your code in opening and closing ticks ```. I have done it for you this time.
I’m not quite sure where we are going with this post. PHP isn’t my area of expertise, but reading up the __call method can be used as a fallback method for methods that have yet to be defined. Maybe for methods you intend to flesh out later.