Re: arithmetic operators in member variable assignments

From: Date: Sat, 12 Aug 2000 15:54:44 +0000
Subject: Re: arithmetic operators in member variable assignments
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-28699@lists.php.net to get a copy of this message
Elaborating on this answer, if you want to have non-constant initializers then move the initialization code to the classes constructor. Andi At 05:24 PM 8/11/00 +0300, Stanislav Malyshev wrote:
SL>> Upon experimentation, I was able to reproduce the error reliably with SL>> the following code: SL>> SL>> <? SL>> class thing {
SL>>         var $member = 12 * 12;
SL>> } SL>> ?> SL>> SL>> That produces a parse error (expecting "," or ";"). SL>> Sure. Var initializers can be only constants. 12*12 isn't constant, it's an experssion. -- Stanislav Malyshev stas@zend.com +972-3-6139665 ext.106 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
--- Andi Gutmans <andi@zend.com> http://www.zend.com/

« previous php.dev (#28699) next »