Re: Re: _Construct question
| From: | Erik Jones | Date: | Thu, 22 Mar 2007 15:01:22 +0000 |
| Subject: | Re: Re: _Construct question | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-251092@lists.php.net to get a copy of this message | ||
On Mar 21, 2007, at 7:14 PM, Chris wrote:
Erik Jones wrote:Ah, yes, looking back I can see how his statement was ambiguous. erik jones <erik@myemma.com> software developer 615-296-0838 emma(r)That's not true, running with v. 5.2.1: <?php class A {He meant that __construct() doesn't work in php4. It's only available in php5. php5 does this: Is the function __construct available? - Yes? Use it. - No? Look for a function with the same name as the class. If that's available, use it. So it's backwards compatible.function A() { echo "works\n"; }} $a = new A(); ?> Outputs: works On Mar 21, 2007, at 8:06 AM, itoctopus wrote:They're basically the same thing, however, you can only use __construct in PHP5.