[nycphp-talk] Accessing Properties in PHP OOP
Scott Mattocks
scott at crisscott.com
Thu Aug 26 11:17:20 EDT 2004
Adam Maccabee Trachtenberg wrote:
> On Thu, 26 Aug 2004, Joseph Crawford Jr. wrote:
>
>
>>better yet, if you want to make things work with php5 as well, do this
>>
>>class client {
>> function client() {
>> $this->__construct();
>> }
>>
>> function __construct() {
>> //constructor here
>> }
>>
>>}
>
>
> This is unnecessary, as PHP 5 will "fallback" if it can't find a
> constructor named __construct() upon the old PHP 4 style constructor
> naming scheme.
>
> -adam
>
But if you don't do it that way then you loose the whole point of
__construct which is to be able to change the name of the class without
having to change the name of all the calls to the parent constructor. If
you don't know where you code will be running or what will happen to it
in the future its probably better to throw in some redundancy.
Scott Mattocks
More information about the talk
mailing list