3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $s = "R&ouml;mer"; $rest = "R&ouml;mer"; $result = "R&ouml;mer"; do { $rest = stristr($rest,$s); echo "rest: $rest<br/>"; $replace = substr($rest,0,strlen($s)); $result = str_replace($replace,"<span class='textHighlight'>{$replace}</span>",$result); $rest = substr($rest,strlen($s)); } while ($rest !== false); echo $result;
Output for 7.0.0 - 7.1.0
rest: R&ouml;mer<br/>rest: <br/><span class='textHighlight'>R&ouml;mer</span>
Output for 4.3.0 - 5.6.28
rest: R&ouml;mer<br/><span class='textHighlight'>R&ouml;mer</span>