I have a relatively large array of elements which I want to search for a string and replace any matches. I\'m currently trying to do this using preg_replace and
preg_replace
your $array contains some further arrays. preg_replace works fine with arrays of strings, but not with arrays of arrays [of arrays...] of strings.
$array