PHP Word Censorship


SUBMITTED BY: Guest

DATE: June 12, 2013, 2:06 p.m.

FORMAT: PHP

SIZE: 457 Bytes

HITS: 953

  1. <?php
  2. function censorWords($text){
  3. $find = array(
  4. '/damn/i',
  5. '/shit/i',
  6. '/fuck/i'
  7. );
  8. $replace = array(
  9. 'dang',
  10. 'shoot',
  11. 'frick'
  12. );
  13. return preg_replace($find,$replace,$text);
  14. }
  15. $text = 'That Damn cat is fucking stupid.';
  16. echo censorWords($text);
  17. ?>

comments powered by Disqus