class A
{
};
class B
{
var $x = new A;
};
PHP 4 gives me a parse error when trying to initialize $x. Is there a way to
make PHP 4 work like it used to or must I move all object property
initializations to the class constructor?
Lance
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general...@lists.php.net
For additional commands, e-mail: php-gene...@lists.php.net
To contact the list administrators, e-mail: php-lis...@lists.php.net
> class B
> {
> var $x = new A;
> };
>
> PHP 4 gives me a parse error when trying to initialize $x. Is there a way to
> make PHP 4 work like it used to or must I move all object property
> initializations to the class constructor?
Yep, you'll have to do it in a constructor. Var's can only be set to strings
or numbers. Setting it using a variable, function, math, etc are not legal.
When I ran into this after converting from 3 to 4 it took me a LOOOOOONG time
of hacking to track it down.
Enjoy,
--Dan
--
PHP scripts that make your job easier
http://www.analysisandsolutions.com/code/
SQL Solution | Layout Solution | Form Solution
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7 Ave, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409