Re: [PHP-DEV] ArrayPath

2014-10-07 Thread Michael Dowling
> This request seems to be more in the realm of having XPath type support for > arrays, likewise people have also attempted to do this with JSON. It does > seem like it could be valuable to some degree, however, I don't necessarily > believe it belongs in the core. This seems much better for a PE

Re: [PHP-DEV] ArrayPath

2014-10-07 Thread Korvin Szanto
In every project I have worked on in the last few years, I've implemented this. If I have an array that I can't be sure is well formed and need to get a value at any depth without triggering expensive notices, the recommended way today is to check if each value is set and is an array: http://3v4l.o

Re: [PHP-DEV] ArrayPath

2014-10-07 Thread Mike Willbanks
On Tue, Oct 7, 2014 at 12:15 PM, Johannes Schlüter wrote: > On Tue, 2014-10-07 at 17:05 +0100, Mathias Grimm 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: > >

Re: [PHP-DEV] ArrayPath

2014-10-07 Thread Ingwie Phoenix
Am 07.10.2014 um 18:05 schrieb Mathias Grimm : > 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'); > > > Re

Re: [PHP-DEV] ArrayPath

2014-10-07 Thread Johannes Schlüter
On Tue, 2014-10-07 at 17:05 +0100, Mathias Grimm 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'); w

Re: [PHP-DEV] ArrayPath

2014-10-07 Thread Mathias Grimm
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) A

Re: [PHP-DEV] ArrayPath

2014-10-07 Thread Mathias Grimm
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

Re: [PHP-DEV] ArrayPath

2014-10-07 Thread Matthew Fonda
On Tue, Oct 7, 2014 at 9:05 AM, Mathias Grimm 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'); > > >

Re: [PHP-DEV] ArrayPath

2014-10-07 Thread Mathias Grimm
This is handy just for programmers using recommended php.ini settings for development (error_reporting = E_ALL and display_errors = On). People using @, display_errors = Off or any other sort of sorcery don't have such problems. On Tue, Oct 7, 2014 at 5:14 PM, Mathias Grimm wrote: > default val

Re: [PHP-DEV] ArrayPath

2014-10-07 Thread Mathias Grimm
default value and existence of index checking. I not a huge change, its a good change and very handy. array( 'basicInformation' => array( 'name'=> 'Mathias', 'surname' => 'Grimm' ), )); // normal php way$sName= isset($post['user']['basicInforma

Re: [PHP-DEV] ArrayPath

2014-10-07 Thread Florian Margaine
Hi! How is it better than: $idx3 = $_POST['idx1']['idx2']['idx3']; ? Regards, Florian Margaine Le 7 oct. 2014 18:05, "Mathias Grimm" a écrit : > 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 ar

[PHP-DEV] ArrayPath

2014-10-07 Thread Mathias Grimm
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