Method Overloading is very basic and useful feature of any OOP language. Though PHP 5 has implemented many OOP features, it cannot demonstrate a real method overloading as seen in other programming languages. Overloading traditionally provides the ability to have multiple methods with the same name but different types and quantities of arguments. Since PHP is a dynamically typed language, this is not possible in PHP. We can not implement overloading by creating multiple functions with same name in class. it will result in an Exception saying Cannot redeclare functionname().
PHP”s interpretation of overloading is different than most object oriented languages. To implement overloading in PHP we will take help of magic method __call. Magic method __call invoked when method called by class object is not available in class.
The syntax for __call() is mixed __call(string $name, array $arguments).
The $name parameter is the name of the method being called. The $arguments parameter is an enumerated array containing parameters passed to the $name method.