Would isset($suffix) not suffice here? There are several things I've
thought of that would be other alternatives to changing this language
construct, but as I don't have my laptop with me, some of the testing to
confirm behavior will have to wait.

Other concerns fall around list() already being a difficult thing for
people to understand, let alone use properly. Making it look even more like
a function definition would likely exacerbate this.

-Chris


On Aug 10, 2017 16:33, "Sara Golemon" <poll...@php.net> wrote:

On Thu, Aug 10, 2017 at 5:21 PM, Andreas Hennings <andr...@dqxtech.net>
wrote:
> I found this RFC, describing a feature I wanted for a long time:
> https://wiki.php.net/rfc/list_default_value
> https://marc.info/?l=php-internals&m=144707619509724
>
> I regularly want this kind of feature when unpacking a string with
explode():
>
> list($prefix, $suffix = NULL) = explode(':', $string);
> if (NULL !== $suffix) {
>   ...
> }
>
Agreed. This comes up for me every time I want to parse a text file
(including about 30 minutes ago, as it happens).

+1

-Sara

Reply via email to