Re: Array dereferencing of scalars
| From: | Yasuo Ohgaki | Date: | Wed, 10 Jun 2015 23:50:22 +0000 |
| Subject: | Re: Array dereferencing of scalars | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-86583@lists.php.net to get a copy of this message | ||
Hi all,
On Thu, Jun 11, 2015 at 7:22 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
> I agree that NULL is debatable. In PHP, NULL is treated as 0/false by its
> context.
> It's simpler if we get rid of the behavior altogether. IMO.
>
If PHP should return NULL always against NULL variables, we may be better
to
reconsider these behavior.
[yohgaki@dev Download]$ php
<?php
$v = NULL;
$$v;
PHP Notice: Undefined variable: in - on line 3
[yohgaki@dev Download]$ php
<?php
$v = NULL;
$v();
PHP Fatal error: Uncaught EngineException: Function name must be a string
in -:3
Stack trace:
#0 {main}
thrown in - on line 3
[yohgaki@dev Download]$ php
<?php
$v = NULL;
$v[123]; // NULL
I don't care much whether these yield NULL always or raise error/exception,
but
there should be consistency.
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net