I have an array, of the following, but it could be of any length
$array = array(); $array = 'a'; $array = 'b'; $array = 'c'; $array = 'd'; $array = 'e'; $array = 'f'; $array = 'g'; $array = 'h'; $array = 'ab'; $array = 'cd'; $array = 'ef'; $array = 'gh'; $array = 'abcd'; $array = 'efgh'; $array = 'abcdefgh'; $array = 'prevValue'; $array = 'prevValue+abcdefgh';
Here it is in tree form structure, and I need to walk the array in this way in my function
For example, if I have a function and I want to compute a walk from a specified value in the tree (lets say 'c'), it will walk the tree taking the values 'd' to the right of c, 'ab' to the top left on the upper level of c, 'efgh', to the top right of 'c' at the next level after that, and then the value 'prevValue' on the very top left.
So, for 'c', it's going left or right as you go up a level.
But depending on the specified document location in the tree diagram, it cannot always 'walk' the tree in this exact fashion.
Example, what if 'g' was selected?
This would be computed going to 'h', then 'ef', then 'abcd', then 'prevValue+abcdefgh'
'b' would be
'a', then 'cd', then 'efgh', then 'prevValue';
How can I code this dynamically corresponding to the location of each document, and if the number of values in the array will always be different??
Here is text that may/may not explain what I am trying to do better.
L = left, R = right.