Hello all,
Anyone know how to remove duplicate entires in a flat file with PHP? I know this can be done with PERL by doing this:
open (INP, "<somefile.txt");
@input=<INP>;
close(INP);
my@InputArray=@input;
my @OutputArray = ();
my %TmpHash = ();
@OutputArray = grep((++$TmpHash{$_} == 1), @InputArray); #remove any duplicates
open (OUT, ">somefile.txt");
print OUT @OutputArray;
close (OUT);
Any help is appreciated!
gary