Rolling log file in PHP
<p>I'd like to write/read a rolling log file with PHP, where only the latest ~300 lines are stored/read and anything older is discarded. I'm not sure of the most efficient way of going about it - it needs to work fast as it's recording page hits on high traffic web sites.</p>

<p>Another PHP script will be regularly reading the log files and using the data for calculations. There are so many PHP file functions I'm confused as to where to start!</p>

<p>I don't think my hosting environment has access to commands such as <code>tail</code> or <code>awk</code> or similar, so a pure PHP solution is preferred. Any help appreciated!</p>
