Re: ArrayPath

From: Date: Tue, 07 Oct 2014 16:42:00 +0000
Subject: Re: ArrayPath
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-77809@lists.php.net to get a copy of this message
For international user this makes more sense because the "'" or the '"' are sensitive keys that needs two interactions instead of just one... so for typing something like $_POST['asasdasd']['asdasd']['asdasd'] is sometimes a bit annoying but it could be solved having 2 keyboard layouts (my case) As I said before, this is not something that is going to change the php direction, however many developer would get very happy. I have never seen this in other languages but my knowledge is not very expressive as well. On Tue, Oct 7, 2014 at 5:36 PM, Mathias Grimm <mathiasgrimm@gmail.com> wrote: > 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 (#77809) next »