I have an haystack that’s an associative array:
$array['header']['title'] = 'MyTitle';
$array['header']['subtitle'] = 'MySubtitle';
$array['body'] = 'MyBody';
I’d wish to replace every occurrence of ‘My’ with ‘Your’.
I’m trying something like this:
$new_array = str_replace('My', 'Your', $array);
Sadly it works only on the first level (ie body key).
Is there anything wrong? Is there a workaround?
1 Answer