Exception or error:
Is there a way I can get this array walk with my anonymous function to set the values?
$url = array('dog', 'cat', 'fish');
array_walk($url, function(&$value, &$key) {
$url[$key] = str_replace('dog', '', $value);
});
echo '<pre>';
print_r($url);
echo '</pre>';
How to solve:
You are already passing the value by reference, so just do the following:
array_walk($url, function(&$value, &$key) {
$value = str_replace('dog', '', $value);
});