Re: [PHP-DEV] arithmetic operators in member variable assignments From: Andi Gutmans (andi <email protected>)
Date: 08/12/00

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 <email protected>
>+972-3-6139665 ext.106
>
>
>--
>PHP Development Mailing List <http://www.php.net/>
>To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
>For additional commands, e-mail: php-dev-help <email protected>
>To contact the list administrators, e-mail: php-list-admin <email protected>

---
Andi Gutmans <andi <email protected>>
http://www.zend.com/

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>