Re: Fatal error: isset(CONST_ARRAY['key']) PHP 5.6
| From: | Christoph Becker | Date: | Mon, 25 May 2015 13:00:53 +0000 |
| Subject: | Re: Fatal error: isset(CONST_ARRAY['key']) PHP 5.6 | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-86376@lists.php.net to get a copy of this message | ||
S.A.N wrote:
> <?php
>
> const CONST_ARRAY =
> [
> 'key' => 'value'
> ];
>
> isset(CONST_ARRAY['key']); // Fatal error: Cannot use isset() on the
> result of an expression (you can use "null !== expression" instead)
>
> ?>
>
> It is design, or a bug?
It is by design; the documentation states[1]:
| isset() only works with variables as passing anything else will
| result in a parse error.
[1]
<http://php.net/manual/en/function.isset.php#refsect1-function.isset-notes>
--
Christoph M. Becker