PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Richard Munroe   dm.File   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example of use of File
Class: dm.File
Wrapper for processing file contents
Author: By
Last change:
Date: 16 years ago
Size: 332 bytes
 

Contents

Class file image Download
<?php

/**
 * Simple example of use of the File wrapper class.
 */

include_once 'class.File.php' ;

function
process(
   
$theFile)
{
    while (
$line = $theFile->gets())
    {
        echo
$line ;
    }

    return
'Processed: ' . $theFile->getName() ;
}

$a = new File('license.txt', 'r', 'process') ;

echo
$a->getStatus() ;
?>