Re: [RFC][DISCUSSION] Allow default value in list() syntax
| From: | Sara Golemon | Date: | Thu, 10 Aug 2017 21:33:26 +0000 |
| Subject: | Re: [RFC][DISCUSSION] Allow default value in list() syntax | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-100174@lists.php.net to get a copy of this message | ||
On Thu, Aug 10, 2017 at 5:21 PM, Andreas Hennings <andreas@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