On Thu, Feb 5, 2009 at 9:36 AM, Hans <desi...@softflow.co.uk> wrote: > > I am really talking about an array as tree, and a way to direct you > to a particular leaf, and use the initial string as the node map. > So it is a multi-branch mapping problem. >
Ah, I understand now. Maybe you could construct the variable call as a string, then eval it. I'm assuming you aren't searching, so you don't need to search all the leaves of the tree, just query a particular leaf. For example: $tree = array(...); //Your tree array that you will be querying. $string = 'k1:k2:k3:...:kn'; $tree_query = '$val = $tree[\''; $tree_query .= str_replace(':', '\'][\'', $string).'\'];'; eval($tree_query); Recursion is complicated, but this way is pretty unsafe. If users input $string, you are open to them inserting something that can be run in php. Avast! Daniel Roesler diaf...@gmail.com _______________________________________________ pmwiki-devel mailing list pmwiki-devel@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-devel