PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Richard Munroe  >  Delimited Text Files  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example of use of DelmitedTextFiles
Class: Delimited Text Files
Parse comma or tab delimited text lines
Author: By
Last change:
Date: 7 years ago
Size: 454 bytes
 

Contents

Class file image Download
<?php

/*
 * You'll need the dm.File class from phpclass.org to run this example.
 *
 * The test file is a sanitized log file from paypal.
 */

include_once('File/class.File.php') ;
include_once(
'class.DelimitedTextFiles.php') ;

function
parse(
   
$theFile)
{
    while ((
$line = $theFile->gets()) !== FALSE)
    {
       
var_dump(DelimitedTextFiles::parse($line, "\t")) ;
        echo
"\n" ;
    }
}

$a = new File('Download.txt', 'r', 'parse') ;
?>