In case of you need to recursively bypass a function over the itens of an array, you can use it
<?php
function array_map_recursive($callback, $array) {
foreach ($array as $key => $value) {
if (is_array($array[$key])) {
$array[$key] = array_map_recursive($callback, $array[$key]);
}
else {
$array[$key] = call_user_func($callback, $array[$key]);
}
}
return $array;
}
?>
-----------------------------------------------------------------------
<?php
$strings = array(
'The',
array(
'quick',
'fox',
array(
'brown',
'jumps',
array(
'over',
array(
'the',
array(
'lazy',
array(
'dog'
)
)
)
)
)
)
);
print_r($strings);
$hashedString = array_map_recursive('md5', $strings);
print_r($hashedString);
?>
------------------------------------------------------------------------
Testing it, you'll obtain
<?php
array (
0 => 'The',
1 =>
array (
0 => 'quick',
1 => 'fox',
2 =>
array (
0 => 'brown',
1 => 'jumps',
2 =>
array (
0 => 'over',
1 =>
array (
0 => 'the',
1 =>
array (
0 => 'lazy',
1 =>
array (
0 => 'dog',
),
),
),
),
),
),
);
array (
0 => 'a4704fd35f0308287f2937ba3eccf5fe',
1 =>
array (
0 => '1df3746a4728276afdc24f828186f73a',
1 => '2b95d1f09b8b66c5c43622a4d9ec9a04',
2 =>
array (
0 => '6ff47afa5dc7daa42cc705a03fca8a9b',
1 => '55947829059f255e4ba2f536a2ae99fe',
2 =>
array (
0 => '3b759a9ca80234563d87672350659b2b',
1 =>
array (
0 => '8fc42c6ddf9966db3b09e84365034357',
1 =>
array (
0 => '0ffe34b4e04c2b282c5a388b1ad8aa7a',
1 =>
array (
0 => '06d80eb0c50b49a509b49f2424e8c805',
),
),
),
),
),
),
);
?>
Hope it helps you.
Cheers.