Array_walk_recursive in PHP
The array_walk_recursive() function runs each array element in a user-made function. The array’s keys and values are parameters in the function. The difference between this function and the array_walk() function is that with this function you can work with deeper arrays (an array inside an array). Returns True or False
In otherwords, Apply a user function recursively to every member of an array .
The array_walk_recursive() applies a user-defined callback function to every element of an array and will recurse into nested arrays. Normally the array_walk_recursive() function takes two arguments: the first one the array being walked over, and the second one the value of the key or index of the array. the third, otional argument is an additional value that you can send to the callback function. the Function returns true on success and false on failure.
If your call back function needs to be working with the actual values of the array, specify the first parameter of the callback as a reference. Then, any changes made to those elements will be made in the original array itself.
<table border=’1′><caption><font size=’-1′> The<em> array_walk_recursive()</em> function</font></caption>
echo “<tr bgcolor=’999FFF’>”;
$numbers is a numeric array containing three arrays.
This callback function takes a reference to the array being walked over as its first argument and $key, which is the index of each element of the array. Its function is to walk through the array cubing each of its elements.
The array_walk_recursive() function takes the array as its first argument, and the name of the function, ‘cube’, as a string value for its second argument. The cube() function is the callback function that will be applied toeach element of the two-dimensional array, $numbers.