Re: [RFC] Bare Name Array
| From: | Andrea Faulds | Date: | Sun, 01 Jun 2014 18:49:27 +0000 |
| Subject: | Re: [RFC] Bare Name Array | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-74671@lists.php.net to get a copy of this message | ||
On 1 Jun 2014, at 19:47, Rafael Kassner <kassner@php.net> wrote:
> This causes a huge backward incompatibility:
>
> define('KEY', 'foo');
> $data = array(KEY => 'bar');
>
> Should $data have 'foo' or 'KEY' as element? AFAIK, some frameworks use
> this constants in array keys.
‘foo’, I checked. Frameworks doing that should really not be, it’s really bad practise to rely
on PHP’s fallback for non-existent constants, and that generates a Notice.
Now you’d have the option of doing array(KEY: ‘bar’) though, which does not resolve the
constant.
--
Andrea Faulds
http://ajf.me/