这是我的代码
<?php
$string = 'this
this
good
good
hahah';
$rows = explode("\n",$string);
$unwanted = 'this|good';
$cleanArray= preg_grep("/$unwanted/i",$rows,PREG_GREP_INVERT);
$cleanString=implode("\n",$cleanArray);
print_r ( $cleanString );
?>
展示
hahah
我想要这样
this
good
hahah
我想保留一个...请帮助我,谢谢大家
慕妹3146593
侃侃尔雅
HUH函数