Write to specific line in PHP
<p>I'm writing some code and I need to write a number to a specific line. Here's what I have so far:</p>

<pre><code>&lt;?php

$statsloc = getcwd() . "/stats/stats.txt";
$handle = fopen($statsloc, 'r+');

for($linei = 0; $linei &lt; $zone; $linei++) $line = fgets($handle);
$line = trim($line);
echo $line;

$line++;
echo $line;
</code></pre>

<p>I don't know where to continue after this. I need to write $line to that line, while maintaining all the other lines.</p>
