Re: Constant arrays
| From: | Paul Dragoonis | Date: | Mon, 19 Dec 2011 20:50:31 +0000 |
| Subject: | Re: Constant arrays | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-56952@lists.php.net to get a copy of this message | ||
2011/12/19 Ángel González <keisial@gmail.com>:
> On 19/12/11 21:23, Paul Dragoonis wrote:
>> Barbu,
>>
>> This is how constants work in all viable languages such as C/++.
> I disagree. In C you can have:
> const data foo[] = { { "Data1", 2 }, { "Data2", 78 } };
Agreed, i was more thinking of #define (not const), when setting up
values such as 'MAX_LEN', being a typical use case for PHP.
>
> It's not unusual in php to have a complex structure that won't change
> in a variable. It should be an array, but as array is not allowed as
> content,
> you need to leave it as a static variable that you won't never change.
>