The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
how to find duplicate entries in textfile?
Hi!
I would like to send an e-mail to 500 people and i have them all in a textfile, seperated this way: info@association.com, admin@association.com, article@association.com, etc. How can i find duplicate entries? Or delete the 2nd entry immediately, doesn`t matter. I was told to use the following code, but it doesn?t work. It gives no error, but doesn?t change anything, it?s even not saved, cause the modification date of the file keeps the same. Can anybody help me, please? Edit: Or if someone could tell me how it works in Excel would be cool. <?php $file = "textfile.txt", // file auslesen $fp = fopen($file, "r"); $txt = fread($fp, filesize($file)); fclose($fp); // emails in array packen $arr = explode(",", trim($txt)); // doppelte email aus array kicken $arr = array_unique($arr); // wieder einen csv-string bauen $str = implode(",", $arr); // zur?ck ins textfile schreiben $fp = fopen($file, "w"); $ok = fwrite($fp, $str, strlen($str)); fclose($fp); clearstatcache(); if($ok) echo "Alles OK"; else echo "Konnte nicht in $file schreiben ..."; ?> |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|