fork(22) download
  1. <?php
  2.  
  3. $str = 'bla bla p.orn, bla bla a.dult bla bla association';
  4.  
  5. $bad_words = array('adult', 'porn', 'ass');
  6. $reg = '~\b' . implode('\b|\b', $bad_words) . '\b~';
  7.  
  8. preg_match_all($reg, preg_replace('~[.,?!]~', '', $str), $matches);
  9.  
  10. if(count($matches[0]) > 0)
  11. echo '"Don“t bypass the badword filter".';
Success #stdin #stdout 0s 82944KB
stdin
Standard input is empty
stdout
"Don´t bypass the badword filter".