title: PHP - Read complete line from a position, strpos()
body: <p><strong>How do I get the complete line from a position gotten by strpos()?</strong></p>
  
  <p>Here is my code:</p>
  
  <pre><code>//$route_route sample: NAXOP UZ45 VIKIK
  
  $route_waypoint = explode(" ", $route_route);
  $file = "components/airways.txt";
  $contents = file_get_contents($file);
  
  foreach ($route_waypoint as $waypoint) {
  
     //$waypoint sample: NAXOP    
     $pos = strpos($contents, $waypoint);
  
        if ($pos === false) {
  
           continue;
  
        } else {
  
        $line = fgets($contents, $pos); // Here is my problem
  
        //line sample: MES,W714,005,NAXOP,38.804139,30.546833,149,000, ,L
  
        list($fix, $lat, $lon, $sample_data1, $sample_data2) = explode(',', $line);
  
        echo "$fix, $lat, $lon";     
  
     }
  
  }
  </code></pre>
  
  <p>The main objective is localize "NAXOP", read his complete line, and echo some data. Any kind of help is welcome!</p>