' . $text; // Truncate old entries (store $bufferLength lines of text) $buffer = array_slice($buffer, -$bufferLength); // Save buffer // [NOTE: file locking issues - a real-world application must lock the file before writing] file_put_contents($bufferFile, implode("\n", $buffer)); } // Read buffer and output as text readfile($bufferFile); exit; ?>