我有两个数组,单词和 stop_words。我想使用 stop_words 查看单词中的匹配项并用 aw**d 替换匹配项。
至今:
$words_arr = explode(",",$result[0]->words);
$words_stop_arr = json_decode($settings['words_stop']);
print_r(str_ireplace($words_stop_arr, "****", $words_arr));
words_arr ->
Array ( [0] => sex [1] => drugs [2] => rock [3] => lamba [4] => runner [5] => rule [6] => going [7] => war [8] => work [9] => eat [10] => program [11] => photography [12] => cart [13] => wart [14] => jungle [15] => dick )
和停用词->
Array ( [0] => dick [1] => orgy [2] => suck [3] => rape )
所以dick应该改成d**k。在我目前的实现中,我只需用 4 个星号更改所有内容......这是不希望的......