PHP array_walk_recursive() Function

PHP array_walk_recursive() Function

The array_walk_recursive () function in PHP is used to apply a user-defined callback function recursively to each element of the array. This function returns a Boolean TRUE on success or FALSE on failure.

Syntax

Parameter

array(required)– This array represents the input array.

callable(required)- It takes two parameters. The first one is the array parameter’s value, and the second one is the key/index.

userdata(optional)- This parameter represents an extra parameter, and it will be passed as the third parameter to the callback. The default value is null.

Return

This function returns a Boolean value TRUE on success or FALSE on failure.

Example 1

Output

Example 2

Output

Example 3

Output