<?php
function censor($text) {
$mask = "-";
$badwords = array("badword1", "badword2", "badword3");
for ($i = 0; $i < sizeof($words); $i++) {
$censored = substr($badwords[$i], 0, 1);
for ($x = 1; $x < strlen($badwords[$i]); $x++) $censored .= $mask;
$text = str_replace($badwords[$i], $censored, $text);
}
return $text;
}
?>