Anybody trying to use preg_replace on multidimensional arrays will see that the function is not working for those cases. Here a quick workaround:
1 2 3 4 5 6 7 8 |
function preg_replace_array($pattern, $replacement, $subject, $limit=-1) { if (is_array($subject)) { foreach ($subject as &$value) $value=preg_replace_array($pattern, $replacement, $value, $limit); return $subject; } else { return preg_replace($pattern, $replacement, $subject, $limit); } } |