Defines an array for storing the result after the row
$result = Array ();
Read UID list file
$fp = fopen (' test.txt ', ' R ');
while (!feof ($FP))
{
$uid = fgets ($FP);
$uid = Trim ($uid);
$uid = Trim ($uid, "R");
$uid = Trim ($uid, "n");
if ($uid = = ")
{
Continue
}
Use UID as key to see if the value exists
if (Empty ($result [$uid])
{
$result [$uid] = 1;
}
}
Fclose ($FP);
Save the results to a file
$content = ";
foreach ($result as $k = $v)
{
$content. = $k. " n ";
}
$fp = fopen (' Result.txt ', ' W ');
Fwrite ($fp, $content);
Fclose ($FP);
?>
Defines an array for storing the results after a row
$result = Array ();
Read the first UID list file and put $result_1
$fp = fopen (' test_1.txt ', ' R ');
while (!feof ($FP))
{
$uid = fgets ($FP);
$uid = Trim ($uid);
$uid = Trim ($uid, "R");
$uid = Trim ($uid, "n");
if ($uid = = ")
{
Continue
}
Write $result with UID key, overwrite if duplicate
$result [$uid] = 1;
}
Fclose ($FP);
Read the second UID list file and perform a sort of a load operation
$fp = fopen (' test_2.txt ', ' R ');
while (!feof ($FP))
{
$uid = fgets ($FP);
$uid = Trim ($uid);
$uid = Trim ($uid, "R");
$uid = Trim ($uid, "n");
if ($uid = = ")
{
Continue
}
Use UID as key to see if the value exists
if (Empty ($result [$uid])
{
$result [$uid] = 1;
}
}
Fclose ($FP);
$result saved in the following the result of the weight can be output to the file, code omitted
?>
http://www.bkjia.com/PHPjc/630861.html www.bkjia.com true http://www.bkjia.com/PHPjc/630861.html techarticle PHP Tutorial//Define an array to hold the result after the row $result = Array ();//Read UID list file $fp = fopen (' test.txt ', ' R '), while (!feof ($fp)) {$uid = FGE TS ($FP); $ui ...