Using Both The Array Key And A Passed-In Value To Modify Each Element Value

<?phpphp
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);
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.