Re: Wired constant expression syntax and bug
| From: | Bob Weinand | Date: | Tue, 01 Jul 2014 11:48:29 +0000 |
| Subject: | Re: Wired constant expression syntax and bug | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-75162@lists.php.net to get a copy of this message | ||
Am 1.7.2014 um 13:25 schrieb Bob Weinand <bobwei9@hotmail.com>:
> Not sure if we should check that. That would be adding a new arbitrary restriction. Now the
> following works:
>
> class Foo {
> const BAR = [
> 3 => ‘qux’,
> 4 => ‘bang’,
> 7 => ‘theta’,
> 9 => ‘epsilon’
> ];
>
> const BAZ = FOO[4];
> }
>
> var_dump(Foo::BAZ);
Woops, mistake in code… written too fast...
Should be:
class Foo {
const BAR = [
3 => ‘qux’,
4 => ‘bang’,
7 => ‘theta’,
9 => ‘epsilon’
];
const BAZ = Foo::BAR[4];
}
var_dump(Foo::BAZ);
http://3v4l.org/78S2C#v560beta2
Bob