The problem is similar to this Find an array inside another larger array
The differences are that instead of searching for values, I'm searching for a small array key branch inside a larger array key tree.
Basically here's the array key branch that I'm looking for:
$mission_parameters['stmt_echo']['subnodes']['exprs'][0]['expr_constfetch']['subnodes']['name']['name']['subnodes']['parts'][0] = 'true';
The array key tree is a very large tree which means it is multidimensional, and it may include $mission_parameters at any point in the tree.
So it's kind of like trying to find a yellow tree branch in a brown tree which may or may not have a yellow tree branch.
Comparing the value at the end of the branch is also necessary.
I'm looking at array_intersect, but it doesn't work on multidimensions. Has anyone solved this kind of problem before?
Note this is not the same as searching array within an array. I'm not searching values.
--EDIT--
Here's an example:
I'm looking for
array(
'statement' => array(
'statement2' => array(
0 => 'true',
),
),
);
Inside a larger array like this:
array(
'statement4' => array(
'statement' => array(
'statement2' => array(
0 => 'true',
),
'statement3' => array(
2 => 'false',
),
),
),
);
Do you see how the smaller array is like a branch to the larger array. The larger array currently contains the smaller branch, but it has other sorts of other elements. Therefore I'm searching an array key branch. In this example it would be [statement][statement2][0] = 'true'
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…