Minase Posted September 23, 2008 Share Posted September 23, 2008 ok this one seem interesting to me i just came from school and i was thinking how to check for duplicate lines into a txt document and leave just 1 thanks each record is on its own line Link to comment https://forums.phpfreaks.com/topic/125454-removing-duplicates/ Share on other sites More sharing options...
carlg Posted September 23, 2008 Share Posted September 23, 2008 I'm not sure which operating system you are using, but if I was on a Linux based system, I would write a very quick script. sort -u <filename.txt> > newfilename.txt You could actually call it from a php script if needed. If you really have the need to do this in php, the only way I could think of is to read the entire file into an array. Then use the array_unique function. Then write the array back out to the file. Link to comment https://forums.phpfreaks.com/topic/125454-removing-duplicates/#findComment-648583 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.