标签:
function FetchRepeatMemberInArray($array) {
// 获取去掉重复数据的数组
$unique_arr = array_unique ( $array );
// 获取重复数据的数组
$repeat_arr = array_diff_assoc ( $array, $unique_arr );
return $repeat_arr;
}
<?php
$words = file(‘zong.txt‘);
$tems = file(‘guolv.txt‘);
$complete_arr = array();
$jieguo = array();
$complete = ‘‘;
foreach($words as $word) {
$word = trim($word);
foreach($tems as $tem) {
$tem = trim($tem);
if($word == $tem){
echo $word.‘!=‘.$tem."</br>";
$jieguo[] = $word;
}
}
}
foreach($jieguo as $item) {
$complete .= $item . "\r\n" ;
}
file_put_contents(‘complete.txt‘, $complete);
echo "OK";
标签:
原文地址:http://www.cnblogs.com/alex-13/p/4523758.html