PHP array_walk_recursive() Function

PHP array_walk_recursive Function


Definition :

The array_walk_recursive() function apply a user-defined function recursively to every element of an array. This function is mainly used with deeper arrays (an array inside an array).

Syntax:

     array_walk_recursive(array, myfunction, parameter...)

Parameter:
Parameter Description
array Required. Specifying an array
myfunction Required. The name of the user-defined function
parameter,... Optional. Specifies a parameter to the user-defined function. You can assign one parameter to the function, or as many as you like.

 Example1 : we can see below example Run each array element in a user-defined function

Output :

The key a has the value web
The key b has the value designing
The key 1 has the value house
The key 2 has the value online