3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by Shanti C
0

There is no method overloading in php. Any solution to this, and there are many, will be a hack.

0

check this..

Don't mistake this for real method overloading, this is actually a misuse of the term "method overloading". __call and __callStatic simply give you a means of calling methods that aren't declared in the class. You would still need a way to determine how many and what type of parameters are being sent so that you can use that information to determine the correct method to call, which actually has more to do with func_get_args, func_get_arg and func_num_args than __call and __callStatic.

I actually wouldn't use __call and __callStatic to overload a method but instead define the method in question and use func_get_args, func_get_arg and func_num_args to apply the logic required to overload it.

Edited by R0bb0b: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.