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\n"; $replace = substr($rest,0,strlen($s)); echo "replace: $replace\n"; $result = str_replace($replace,"<span class='textHighlight'>{$replace}</span>",$result); echo "result: $result\n"; $rest = substr($rest,strlen($s)); echo "rest': $rest\n"; } while ($rest !== false); echo $result;
Output for 7.0.0 - 7.1.0
rest: R&ouml;mer replace: R&ouml;mer result: <span class='textHighlight'>R&ouml;mer</span> rest': rest: replace: result: <span class='textHighlight'>R&ouml;mer</span> rest': <span class='textHighlight'>R&ouml;mer</span>
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0
rest: R&ouml;mer replace: R&ouml;mer result: <span class='textHighlight'>R&ouml;mer</span> rest': <span class='textHighlight'>R&ouml;mer</span>