fork download
  1. <?php
  2. function sanitize($string) {
  3. $list = array(
  4. "/dumb/",
  5. "/stupid/",
  6. "/brainless/"
  7. );
  8.  
  9. # replace bad words
  10. $string = preg_replace_callback($list,
  11. function ($matches) {
  12. return preg_replace('/\B./', '-', $matches[0]);
  13. },
  14. $string);
  15. return $string;
  16. }
  17.  
  18. echo sanitize('hello, i think you are not intelligent, you are actually dumb and stupid.');
Success #stdin #stdout 0.02s 24048KB
stdin
Standard input is empty
stdout
hello, i think you are not intelligent, you are actually d--- and s-----.