Ask a Question related to PHP Development, Design and Development.
-
Greg Beaver #1
Re: [PHP] OO function overloading?
Hi,
This statement isn't entirely correct, overloading is possible with the
overload extension.
[url]http://www.php.net/overload[/url]
Regards,
Greg
--
phpDocumentor
[url]http://www.phpdoc.org[/url]
Curt Zirzow wrote:> * Thus wrote Jean-Christian IMbeault (jc@mega-bucks.co.jp):
>>>>Is it possible to overload a function is a class. I would like to have
>>the same function defined differently depending on the number of
>>arguments passed in. For example:
>
> overloading isn't possible in php4.
>
> CurtGreg Beaver Guest
-
#40441 [NEW]: mbstring function overloading turns on randomly
From: dmitry at rsl dot ru Operating system: linux PHP version: 5.2.1 PHP Bug Type: mbstring related Bug description: ... -
#39361 [NEW]: mbstring function overloading - local value ignored
From: christoph at ziegenberg dot de Operating system: Win XP SP 2 PHP version: 5.2.0 PHP Bug Type: mbstring related Bug... -
#39361 [Opn]: mbstring function overloading - done although not activated
ID: 39361 User updated by: christoph at ziegenberg dot de -Summary: mbstring function overloading - local value ignored... -
newbie question: function overloading
I need to define a method that performs differently when operated on objects of different type (overloading). Currently I use various if's to check... -
Overloading ()
Hi, I was reading the comp.lang.functional group, and happened across a little discussion of Ruby vs. Python on there. One thing the Python guy... -
Jean-Christian Imbeault #2
Re: [PHP] OO function overloading?
Greg Beaver wrote:
True. Nice work. But still a hack in my mind :) (though a *very* clean> This statement isn't entirely correct, overloading is possible with the
> overload extension.
hack).
Jean-Christian Imbeault
Jean-Christian Imbeault Guest
-
Andy Crain #3
RE: [PHP] OO function overloading?
Or, if you'd rather not use an experimental extension, there's this hack
(learned from [url]http://www.phpbuilder.com/columns/luis20000420.php3):[/url]
class MyClass{
function MyClass(){
$name = 'MyClass' . func_num_args();
$this->$name();
}
function MyClass1($x){
}
function MyClass2($x,$y){
}
function MyClass3($x,$y,$z){
}
//etc.
}
Andyof> -----Original Message-----
> From: Greg Beaver [mailto:greg@chiaraquartet.net]
> Sent: Wednesday, August 06, 2003 1:09 AM
> To: Jean-Christian Imbeault
> Cc: [email]php-general@lists.php.net[/email]
> Subject: Re: [PHP] OO function overloading?
>
> Indeed it is a hack, but not for PHP 5, the extension has become partthe> 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 withclean> >> >>overload extension.
> >
> > True. Nice work. But still a hack in my mind :) (though a *very*>> > hack).
> >
> > Jean-Christian Imbeault
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
Andy Crain Guest



Reply With Quote

