Am 07.10.2014 um 18:05 schrieb Mathias Grimm <mathiasgr...@gmail.com>:

> 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

Oh my god. This is seriously one enhancement that I haven’t seen before. If a 
function like this makes it into PHP, we can speak of one very unique 
enhanement here. I like the example of a later email, as in

    $_POST::get(…)

Extending the capabilities of arrays and giving them something like above, 
would be nice. But I can see where the syntax would clash: $_POST would be 
expected to be an object with a __toString() method, :: refferences to a static 
method… 

But maybe, some smart head can figure something out. It would, at least, be an 
interesting functionality.

By the way, I would suggest swapping the path and array argument. As in, „Get 
from $array the path ‚…‘“. Just a suggestion.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to