php - Is it possible to track where I am in an array with array_walk_recursive? -


let's have array this:

array (     ['one'] => array (                       ['wantedkey'] => 5                       ['otherkey1'] => 6                       ['otherkey2'] => 7                      )     ['two'] =>  => array (                       ['otherkey1'] => 5                       ['otherkey2'] => 6                       ['wantedkey'] => 7                      )     ['three'] =>  => array (                       ['otherkey1'] => 5                       ['wantedkey'] => 6                       ['otherkey2'] => 7                      ) ) 

if apply sth array instances of 'wantedkey':

function test_print($item, $key) {   if ($key === 'wantedkey') {     print $item;   } }  array_walk_recursive($myarray, 'test_print'); 

but array_walk_recursive doesn't tell me (afaik) in array....is there way track position 'wantedkey' has been found in example above array_walk_recursive?

any hint highly appreciated, in advance! :-) know has been asked before i'm wondering if has found solution yet...

use recursivearrayiterator if need track element position , hierarchy.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -