Not signed in (Sign In)

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.


    • CommentAuthorwebguy
    • CommentTimeOct 26th 2006
     
    hi.

    I have a mailing list in a text file, lot of emails in the list are for more than one times. As this list is too big i can't really go through by hand removeing them.

    So does anyone have a php code snippet i could use to remove all the duplicates from the text file?
    • CommentAuthorprogrammer
    • CommentTimeOct 26th 2006
     
    This works on a list of 143,166 lines.

    <?php
    $list = file('rawlist.txt');
    $list = array_map("strtolower", $list);
    $list = array_unique($list);
    sort($list, SORT_STRING);
    file_put_contents('unique.txt', implode('', $list));
    ?>