Using both the array key and a passed-in value to modify each element value
<?php
function change(&$element, $key, $mark) {
$element = "$mark$key$mark, the $element";
}
$dogs = array('A' => 'C', 'B' => 'D', 'X' => 'Z');
array_display($dogs, TRUE);
array_walk($dogs, 'change', '*');
array_display($dogs, TRUE);
?>
Related examples in the same category