Skip to content

Instantly share code, notes, and snippets.

Created March 7, 2011 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/858610 to your computer and use it in GitHub Desktop.
Save anonymous/858610 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