3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $source = 'quick, brown" (for example), but not "quick and brown". So whe'; $test = "QUICK BROWN"; $temp = explode(" ", $test); $temp = array_map(function ($val) { return preg_quote($val, "~");}, $temp); $pattern = '~('.implode("[^A-Za-z0-9]+", $temp).')~i'; echo preg_replace( $pattern , '<span class="hilite">$1</span>', $source );
based on 5ubPS
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.6
<span class="hilite">quick, brown</span>" (for example), but not "quick and brown". So whe