Re: Why Constants could Not be Array?
| From: | Stuart Dallas | Date: | Sat, 30 Apr 2011 13:05:14 +0000 |
| Subject: | Re: Why Constants could Not be Array? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-312586@lists.php.net to get a copy of this message | ||
On Saturday, 30 April 2011 at 10:51, Walkinraven wrote:
For needing a constants=array, I have to use
> 'public static $a = array(...)'
>
> instead.
>
> Why the language could not relax the restriction of constants?
As I understand it constants must be declarations not evaluations because they're initialised
during parsing not execution. Arrays are evaluations even if they only contain literal values. It
could be done, but it would require a fundamental change to the engine and the benefit-cost
calculation just doesn't add up.
-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/