3v4l.org

run code in 300+ PHP versions simultaneously
<?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 );

preferences:
58.51 ms | 402 KiB | 5 Q