Or, if you'd rather not use an experimental extension, there's this hack
(learned from http://www.phpbuilder.com/columns/luis20000420.php3):

class MyClass{

        function MyClass(){
                $name = 'MyClass' . func_num_args();
                $this->$name();
        }

        function MyClass1($x){
        }

        function MyClass2($x,$y){
        }

        function MyClass3($x,$y,$z){
        }
        
        //etc.
}

Andy
> -----Original Message-----
> From: Greg Beaver [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 06, 2003 1:09 AM
> To: Jean-Christian Imbeault
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] OO function overloading?
> 
> Indeed it is a hack, but not for PHP 5, the extension has become part
of
> the core, and does not require that odd little "overload()" call :)
> 
> Greg
> 
> Jean-Christian Imbeault wrote:
> 
> > Greg Beaver wrote:
> >
> >
> >>This statement isn't entirely correct, overloading is possible with
the
> >>overload extension.
> >
> >
> > True. Nice work. But still a hack in my mind :) (though a *very*
clean
> > hack).
> >
> > Jean-Christian Imbeault
> >
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to