PHP array_walk() Function
What is array_walk() Function?
Explanation
The "array_walk()" function apply a user function to every member of an array.
Syntax:
array_walk(array,function,parameter...)
In the above syntax each member of the "array" is applied to the user defined "function", and also can have parameters.
Example :
<?php
function funct1($value,$key)
{
echo "The key $key has the value $value <br/>";
}
$b=array("1"=>"Cherry","2"=>"Apple");
array_walk($b,"funct1");
?>
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.