fork(9) download
  1. <?php
  2. $str = "my bird is funny and | is a pipe";
  3. $keyword = "bird fun |";
  4. $keyword = implode('|',explode(' ',preg_quote($keyword)));
  5. var_dump($keyword);
  6. $str = preg_replace("/($keyword)/i","<b>$0</b>",$str);
  7. echo $str;
Success #stdin #stdout 0.02s 13064KB
stdin
Standard input is empty
stdout
string(11) "bird|fun|\|"
my <b>bird</b> is <b>fun</b>ny and <b>|</b> is a pipe