Remove duplicate lines from a file.
<?php
// filename
$filename = 'cars.txt';
$text = array_unique(file($filename));
$f = @fopen($filename,'w+');
if ($f) {
fputs($f, join('',$text));
fclose($f);
}
?>
Change cars.txt above to target file name. Result will be saved into the same file.
If you want to same result to another file replace $f = @fopen($filename,'w+'); with $f = @fopen('result-file-name.txt','w+');