Re: ArrayPath
| From: | Matthew Fonda | Date: | Tue, 07 Oct 2014 16:21:45 +0000 |
| Subject: | Re: ArrayPath | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-77807@lists.php.net to get a copy of this message | ||
On Tue, Oct 7, 2014 at 9:05 AM, Mathias Grimm <mathiasgrimm@gmail.com>
wrote:
> Hi,
> I would like to suggest something for php like a class I am using
>
> https://github.com/mathiasgrimm/arraypath
>
> The reason is to access arrays like this:
>
> $idx3 = ArrayPath::get('idx1/idx2/idx3', $_POST, 'myDefaultValue');
>
>
> Regards,
> Mathias
>
Hi Mathias,
The new null coalesce operator in PHP 7 achieves what you're looking for
here. See https://wiki.php.net/rfc/isset_ternary
Best regards,
--Matthew