title: fseek() by line, not bytes?
body: <p>I have a script that parses large files line by line. When it encounters an error that it can't handle, it stops, notifying us of the last line parsed.</p>
  
  <p>Is this really the best / only way to seek to a specific line in a file? (<code>fseek()</code> is not usable in my case.)</p>
  
  <pre><code>&lt;?php
  
  for ($i = 0; $i &lt; 100000; $i++)
      fgets($fp); // just discard this
  </code></pre>
  
  <p>I don't have a problem using this, it is fast enough - it just feels a bit dirty. From what I know about the underlying code, I don't imagine there is a better way to do this.</p>