NYCPHP Meetup

NYPHP.org

[nycphp-talk] Method overloading

Kenneth Downs ken at secdat.com
Fri Dec 14 17:53:49 EST 2007


Michael B Allen wrote:
> On 12/14/07, Kenneth Downs <ken at secdat.com> wrote:
>   
>> Ben Sgro wrote:
>>     
>>> Ok, so you the answer is "no", you can't do method overloading in php?
>>>       
>> AFAIK, Yes, the answer is no :)
>>     
>
> Method overloading could mean overloading the method in a subclass so
> to say "you can't do method overloading in php" is false. 

That's overriding, not overloading.

> PHP does
> support method overloading. It just doesn't support using the same
> method name with different signatures.
>   

Overloading is by definition exactly what it does not allow, having 
different methods of the same name with different signatures.

> But as you point out, PHP does allow optional / default values instead
> which achieves a very similar result (and in fact I find it to be
> superior in many ways).
>   

Overloading is a requirement for strongly typed languages, since PHP is 
not strongly typed it can get by without it.  I also find PHP's loose 
typing far more appropriate to its role as a string generator (sql, 
HTML), and appreciate its default values as part of its entire 
philosophy of flexibility.

> Mike
>
>   


-- 
Kenneth Downs
Secure Data Software, Inc.
www.secdat.com    www.andromeda-project.org
631-689-7200   Fax: 631-689-0527
cell: 631-379-0010

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20071214/ddab6180/attachment.html>


More information about the talk mailing list