This function works just like array_walk() with the added bonus of calling array_walk() automatically on any element of your array which is an array.

$arr = array( 'one'   => array( 'A' => 'Alligator',
                                'a' => 'apple' ),
              'two'   => array( 'B' => 'Bull',
                                'b' => 'banana' ),
              'three' => array( 'C' => 'Crab',
                                'c' => 'carrot' ),
              'four'  => array( 'D' => 'Dingo',
                                'd' => 'durian' ),
              'na'    => 'Not an Array' );
 
function isFor( $word, $letter ) {
  echo "$letter is for $word\n";
}
array_walk_recursive( $arr, 'isFor' );
/*
A is for Alligator
a is for apple
B is for Bull
b is for banana
C is for Crab
c is for carrot
D is for Dingo
d is for durian
na is for Not an Array
*/

Some versions of PHP had a bug which caused the array to be altered. Some of the keys would be transformed into references which could cause your data to be changed without you realizing it.