Re: ArrayPath

From: Date: Tue, 07 Oct 2014 16:36:07 +0000
Subject: Re: ArrayPath
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-77808@lists.php.net to get a copy of this message
Great! That solves 75% of the problem. Still accessing index using "/" (or other separator) would be very handy $c = $_POST::path('a/b/c', 'def') $c = $_POST::('a/b/c', 'def') $c = $_POST@('a/b/c', 'def') $c = $_POST::at('a/b/c', 'def') I am not really creative now, but the part I would like to highlight is the feature and not really the syntax. On Tue, Oct 7, 2014 at 5:21 PM, Matthew Fonda <mfonda@php.net> wrote: > 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 >

« previous php.internals (#77808) next »