array_walk applies the user-defined function add_prefix to each element of the array fruits.

$fruits = array(“a” => “apple”, “b” => “banana”, “o” => “orange”, “g” => “grape”, “p” => “pineapple”);

print_r($fruits);

array_walk($fruits, ‘add_prefix’, “Fruit”);

print_r($fruits);

function add_prefix(&$item1, $key, $prefix)
{
$item1 = “$prefix: $item1″;
}