Login   Register  
PHP Classes
elePHPant
Icontem

File: description.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Arthur Tumanyan  >  shagaTail  >  description.php  >  Download  
File: description.php
Role: Documentation
Content type: text/plain
Description: Description
Class: shagaTail
Get the last lines of a file like the tail command
Author: By
Last change:
Date: 2007-03-26 22:21
Size: 885 bytes
 

Contents

Class file image Download
 <html>
 <head><title>shagaTail class description</title></head>
<body>
<p>This is a simple class for reading files from the end,like Unix 'tail' command.But 
  with some limitations!You can get only the last line<br />
  There are many implementations like this,but this use less memory,than others,i 
  hope... </p>
<p><font size="2" color="#990033">How you can use it?</font> </p>
<p>An example:<br />
  <br />
</p>
<pre><font color="#0066FF">&lt;?

 //
 // tail-usage.php
 //
 //
 require_once("shagaTail.php");
 $myShaga = new shagaTail;
 $myShaga->tailFile = 'filename.log'; //setting the filename
 for(;;){
 	$line = $myShaga->getStr();
 	// Analize the line or just print it
 	echo $line."<br />\n";
 	$myShaga->update(); // if the tailed file file is updated,tail it again
 }

 </font></pre>
<font color="#0066FF"> ?&gt; </font> 
</body>
 </html>