Re: php5 class initialization

From: Date: Tue, 23 Mar 2004 21:11:01 +0000
Subject: Re: php5 class initialization
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-8704@lists.php.net to get a copy of this message
At 09:16 AM 3/23/2004 -0800, Rasmus Lerdorf wrote:
On Tue, 23 Mar 2004, George Schlossnagle wrote: On Mar 23, 2004, at 11:53 AM, Andrei Zmievski wrote:
On Mon, 22 Mar 2004, Andi Gutmans wrote:
What would you expect? That if a new style constructor is defined we always use that and allow old-style as regular method?
Yep.
I agree with the part about the new-style constructor always being preferred to the old-style constructor, but besides being really confusing, where do you being able to call the old-style as a regular method coming in handy? I could see people doing: class foo {
    function foo() {
       ...constructor stuff...
    }
    function __construct() {
       $this->foo();
    }
} In order to make the class work on both PHP4 and PHP5 in which case it would be essential for foo() to be callable as a regular method in the class.
This is possible already. Andi

« previous php.internals (#8704) next »