PHP:用* [关闭]替换.txt文件中列表中的单词

I've searched around the web for days now, and I can't get an answer for my problem...

So this is what I need to do:
I have an .txt-file which contains one word per line. Let's say it's called list.txt.
And I have another .txt-file called text.txt with random stuff in it.
Now I want to have a PHP-file which checks if it finds words from list.txt in the text.txt-file and replace them with ******.


THANK YOU VERY MUCH FOR ANY HELP!

Consider this as a kind of pseudocode, although it's PHP. It should guide you for your desired solution:

$content = file_get_contents('text.txt');
$censored = explode("
", file_get_contents('list.txt'));
$content = str_replace($censored, '*****', $content);
file_put_contents('text.txt', $content);
$str=file_get_contents('text.txt');
$str=str_replace("list.txt","****",$str); 
file_put_contents('text.txt', $str);