I have a String which contains substrings which I have to replace. The substrings are stored in an array. When I loop through the array everything works fine, until the array has more than 120 entries.
foreach ( $activeTags as $k => $v ) {
$find = $activeTags[$k]['Tag']['tag'];
$replace = 'that';
$pattern = "/\#\#[a-zA-Z][a-zA-Z]\#\#.*\b$find\b.*\#\#END_[a-zA-Z][a-zA-Z]\#\#|$find/";
$sText = '<p>Do not replace ##DS## this ##END_DS## replace this.</p>';
$sText = preg_replace_callback($pattern, function($match) use($find, $replace){
if($match[0] == $find){
return($replace);
}else{
return($match[0]);
}
}, $sText);
}
when count($activeTags) == 121 i only get an empty string.
Has onyone an idea why this happens?

var_dumpyour array?$activeTagsarray content with 121 entries ?