i have need of show only the last occurence when the rows are the same serial number.
Those are the lines of my txt file:
ID| NAME | SERIAL
1;  John;  00001;
2;  Mike;  00002;
3;  John;  00001;
  // open file
  $file = fopen("Data.txt","r");
  // loop lines
  while(!feof($file)){
      $line =  fgets($file);
      $explode_line = explode(";",$line);
      $id = $explode_line[0];
      $serial = $explode_line[1];
      if ($serial == $_POST['serial'])) {
          echo $id . ' - ' . $serial;
      }
  }
  fclose($file);
Result must be: 
3;  John;  00001;
and not:
1;  John;  00001;
3;  John;  00001;
 
     
     
     
     
    