<?
$cenzor = "krava ofca patko patka kurva laino";
$text = "golqma krava si ma patka zaspala ofca oagnena";

function pip($len) {
  for($f=1 ;$f<=$len ; $f++) { $replace = "$replace*"; }
  return $replace;
}
function cenzor($text,$cenzor) {
  $part = explode(" ", $cenzor);
  $count = count($part)-1;
  for($i=0 ;$i<=$count ; $i++) {
    if (eregi($part[$i],$text)) {
      $fraza = strlen($part[$i]);
      $text = eregi_replace($part[$i],pip($fraza),$text);
    }
  }
  echo $text;
}
cenzor($text,$cenzor);
?>
Published in: PHP
Download

Related snippets