Skip to content

Instantly share code, notes, and snippets.

@avdg
Forked from anonymous/gist:858610
Created March 7, 2011 15:15
Show Gist options
  • Save avdg/858615 to your computer and use it in GitHub Desktop.
Save avdg/858615 to your computer and use it in GitHub Desktop.
#!/usr/bin/php
<?php
function find_person($value, $key, $search_term)
{
if($value == $search_term){
print "Found $search_term in $key\n";
return $the_person_id_in_the_same_array_as_this_term;
}
}
$AoH = array(
'name' => 'beavis',
'person_id' => 'bvs',
'children' => array( 'name' => 'butthead', 'person_id' => 'bth' ),
);
$the_person_id_i_want = array_walk_recursive($AoH, 'find_person', 'cornholio');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment