日期:2014-05-16 浏览次数:20588 次
$a = "'你好.你好','你好啊ct','他好','他好啊','我好','我好啊'";
$a = "'你好.你好','你好啊ct','他好','他好啊','我好','我好啊'";
$b=explode(',',$a);
$c = array(".", "ct");
foreach($b as $value){
foreach($c as $v){
if(strpos($value,$v) !==false){
$ar[]=$value;
break;
}
}
}
$result = array_diff($b, $ar);
echo join(',',$result);
$a = "'你好.你好','你好啊ct','他好','他好啊','我好','我好啊'";
$b=explode(',',$a);
$c = array(".", "ct");
foreach($c as $v){
$p="/" .preg_quote($v) ."/";
$ar[]=array_values(preg_grep($p,$b));
}
foreach($ar as $v) $arr[]=$v[0];
$result=array_diff($b,$arr);
echo join(',',$result);