__call in PHP 5


The magic method __call is very similar to the __get and __set magic methods. The __call magic method is called when a method of a class is called that doesn't exist.

The __call method takes two parameters, the first parameter is the name of the method that is being called and the second is an array that holds the parameters of that method (if any).

The code above would throw an error when the ‘printName‘ method is called because it does not exist within the 'WebDeveloper' class therefore the __call method takes over.