NYCPHP Meetup

NYPHP.org

[nycphp-talk] Flattening a Tree

Ajai Khattri ajai at bitblit.net
Mon Feb 23 18:51:04 EST 2009


On Mon, 23 Feb 2009, csnyder wrote:

> Append each sub-key's name to the current name, separated by an underscore.
> 
> $deep['foo']['bar']['quux']
> 
> becomes
> 
> $flat['foo_bar_quux']
> 
> Provided the keys don't have underscores in them already, of course. ;-)

Its a tree structure so Ive no idea how many arrays are in there, so Id 
need to walk through each array recursively and get keys?


-- 
Aj.




More information about the talk mailing list