Apply a user-defined function to every member of an array.
Source Code
function printWithPrefix($value, $key) {
echo "The value of $key is $valuen";
}
$fruits = ['apple' => 'red', 'banana' => 'yellow'];
array_walk($fruits, 'printWithPrefix');
Apply a user-defined function to every member of an array.
function printWithPrefix($value, $key) {
echo "The value of $key is $valuen";
}
$fruits = ['apple' => 'red', 'banana' => 'yellow'];
array_walk($fruits, 'printWithPrefix');