fork(2) download
  1. <?php
  2.  
  3. $str = "this is isolated is an example of this and that";
  4. $testArray = array('is','isolated','somethingElse');
  5. echo preg_replace('~\b(?:' . implode('|', $testArray) . ')\b~i', '#$0', $str);
Success #stdin #stdout 0.01s 52488KB
stdin
Standard input is empty
stdout
this #is #isolated #is an  example of this and that