Re: array coalesce operator concept
| From: | Stanislav Malyshev | Date: | Wed, 12 Jul 2017 18:00:12 +0000 |
| Subject: | Re: array coalesce operator concept | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-99862@lists.php.net to get a copy of this message | ||
Hi!
> Code will error if a non-array value is passed through a looping feature.
> For example, this code:
>
> <?php
>
> $foo = "abc";
>
> foreach ($foo as $bar) {
Looks like $foo??[] would work here. If $foo is something like false or
null, that is. If it's not, this is probably a serious bug (why would
you iterate on something that is a number or a non-iterable object) and
should be either fixed or resolved explicitly, not hidden.
--
Stas Malyshev
smalyshev@gmail.com