PHP array_walk() Function

What is array_walk() Function?


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



In the above syntax each member of the "array" is applied to the user defined "function", and also can have parameters.

Example :

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

The key 1 has the value Cherry
The key 2 has the value Apple

In the above example all the elements of the array "$b" is applied in the function "funct1" to display the result.

PHP Topics

Ask Questions

Ask Question