Re: Has this always been the case?

From: Date: Fri, 31 May 2013 11:08:16 +0000
Subject: Re: Has this always been the case?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-321292@lists.php.net to get a copy of this message
Yes, this has been always the case. The property initializer in PHP can not have any expression. It should be constant value. If you want to use expression here use the constructor. class MyClass{ protected $nonStaticField; static protected $staticField; public function __construct(){ $this->nonStaticField = 4+5; } static public function init(){ self::$staticFiled = 4+5; } } -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader

« previous php.general (#321292) next »