<?php
function star_censor($str,$censored)
{

    if (!is_array($censored)) {

        return $str;
    }

    foreach ($censored as $badword) {
        $stars='';
        $badword_length = strlen($badword);
        for ($i = 0; $i < $badword_length ; $i++) {
            $stars=$stars.'*';
        }
        $str = str_ireplace($badword, $stars, $str);


    }
    return trim($str);
}





        ?>