Re: PHP4 vs PHP5 classes

From: Date: Wed, 30 Jul 2008 05:26:43 +0000
Subject: Re: PHP4 vs PHP5 classes
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-277451@lists.php.net to get a copy of this message
Chris wrote:
Don't forget that in PHP5, the constructor named has changed. In PHP4 it called a method with the same name as the class. But, in PHP5, it looks for __construct() instead.
If __construct doesn't exist then it falls back to the php4 way - makes it backwards compatible :)
But, if people want to code to php5 standards and beyond, then I would recommend always using the __construct() method to construct your class. Then make it work in php4. Not the other way around.

« previous php.general (#277451) next »