0

I have a textfile containing:

name : id : phone    
Ahmed : 1 : 972258522    
Ali : 2 : 741852933    
Jack : 5 : 741852963    
Ahmed : 77 : 85296    
mia : 7852 : 8888888    
Jack : 77 : 9999999

i want to remove duplicate line that have the same name i need the output as :

Ahmed : 1 : 972258522   
Ali : 2 : 741852933    
Jack : 5 : 741852963    
mia : 7852 : 8888888
Rizier123
  • 58,877
  • 16
  • 101
  • 156
  • Have you tried something? Start with some code, it's always good – Rizier123 Mar 15 '15 at 01:06
  • 1
    Create an array for names; loop through the file one line at a time; extract name from the line; if name isn't in the names array, put it in the array and write the line; continue till end of file – Mark Baker Mar 15 '15 at 01:06
  • i was use this code put i have get error Parse error: syntax error, unexpected '[' in C:\xampp\htdocs\a\index.php on line 6 iam using php 5.3 – romeo hamad Mar 15 '15 at 21:43

0 Answers0