Re: OOP variables

From: Date: Thu, 15 Apr 2004 14:40:02 +0000
Subject: Re: OOP variables
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-183463@lists.php.net to get a copy of this message
> [quote] > In PHP 4, only constant initializers for var variables are allowed. To > initialize variables with non-constant values, you need an > initialization function which is called automatically when an object > is being constructed from the class. Such a function is called a > constructor (see below). > [/quote] Another thing to consider is whether your class needs to or could be accessed statically. If it can then whatever variables you might need in executing the class methods can't be solely defined in the constructor. When used statically, the class' constructor is (obviously) never run. Chris

« previous php.general (#183463) next »