PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Hamid Ghorashi   Read Text Files   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: Read Text Files
Read text files line by line
Author: By
Last change: the required file was updated.
Date: 12 years ago
Size: 308 bytes
 

Contents

Class file image Download
<?php

require("textfilereader.class.php");

$filename = "testfile.txt";
$sf = new TextFileReader($filename);
       
$sf->seekLine(1); // Go to line 1
   
while (($val = $sf->readLine())!=NULL)
            echo
$val."<br/>";
        
        echo
"Total number of lines: ".$sf->countLines();
?>