<?php
$text = 'Sonance Visual Performance Series features an award-winning <a href="">Visual Performance Series</a> low-profile grille that is paintable to blend into the wall or ceiling. With three shapes and sizes, several performance levels, and a range of Sonance Landscape Series specialty /ThinLine application speakers, a consistent look can be achieved for any application in every space.';
$skipDictionary = array(
'all' => array(
'Visual Performance',
'ThinLine',
'Extreme',
'Architectural Series',
'Invisible Series',
'Cinema',
'Soundbar',
'Subwoofers',
'Sonance Landscape Series',
'Satellites',
'Subwoofers',
'Systems',
'Sonarray',
'Mariners',
'Medium'
)
);
$replaceArray = array_map(function($val){
return '<span class="notranslate">'.$val.'</span>';
}, $skipDictionary['all']);
foreach($skipDictionary['all'] AS $idx => $search) {
$text = preg_replace('@(\s|\>|^)'.$search.'(\s|$)@', $replaceArray[$idx], $text);
}
echo '<div>'.$text.'</div>';
<div>Sonance<span class="notranslate">Visual Performance</span>Series features an award-winning <a href=""<span class="notranslate">Visual Performance</span>Series</a> low-profile grille that is paintable to blend into the wall or ceiling. With three shapes and sizes, several performance levels, and a range of<span class="notranslate">Sonance Landscape Series</span>specialty /ThinLine application speakers, a consistent look can be achieved for any application in every space.</div>
Output for 5.2.3 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/jY0NH on line 23
Process exited with code 255.
<br />
<b>Parse error</b>: syntax error, unexpected T_FUNCTION, expecting ')' in <b>/in/jY0NH</b> on line <b>23</b><br />
Process exited with code 255.