PHP array_walk_recursive() Function

What is array_walk_recursive() Function?


The "array_walk_recursive()" function apply a user function recursively to every member of an array.



In the above syntax all elements of the "array" is called in an user defined "function" recursivley, even there can be some parameters given using "parameters" option.

Example :

function funct1($value,$key)
echo "The key $key has the value $value <br/>";
Result :

The key a has the value Guava
The key b has the value Orange
The key 1 has the value Cherry
The key 2 has the value Apple

In the above example all the elements of the array "$a","$b" are send to the user defined function recursively and the result is displayed.

PHP Topics

Ask Questions

Ask Question