3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function bold($word, $sentence){ $result = preg_replace('~\b(' . preg_quote($word, '~') . ')\b~i', '<span class="found">$1</span>', $sentence); return $result; } $query = 'google'; $description = 'google this and that okay'; $thing = bold($query, $description); echo $thing;
Output for 4.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
<span class="found">google</span> this and that okay
Output for hhvm-3.10.0

Process exited with code 153.