Login   Register  
PHP Classes
elePHPant
Icontem

File: fileexample.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Gary Bhat  >  File Reader  >  fileexample.php  >  Download  
File: fileexample.php
Role: Example script
Content type: text/plain
Description: File Reader and word search
Class: File Reader
Read and search text files
Author: By
Last change:
Date: 2013-04-06 10:09
Size: 1,524 bytes
 

Contents

Class file image Download
<?php

/**
 * Description of filereader
 * The file has following functions
 * 
 * Function 1 - reads each character
 * 1. charreader($filename)
 * Function 2 - reads each character into array
 * 2. chararrayreader($filename)
 * Function 3 - reads file contents into array
 * 3. arrayreader($filename)
 * Funtion 4 - searches for similar words/ phrase in file, case sensitive
 * 4. searchwordcase($filename, $words)
 * Funtion 5 - searches for similar words/ phrase in file, case insensitive
 * 5. searchwordnocase($filename, $words)
 * 
 * @author: GB
 * @email: ganeshsurfs@gmail.com
 * @Website: N.A.
 */

include "c_filereader.php";

$testreader = new filereader();
$tempobject $testreader->charreader("testing.txt");
print_r($tempobject);
print 
"<br>Charreader function done<br>";

$tempobject "";
$tempobject $testreader->chararrayreader("testing.txt");
var_dump($tempobject);
print 
"<br>Chararrayreader function done<br>";

$tempobject "";
$tempobject $testreader->arrayreader("testing.txt");
print_r($tempobject);
print 
"<br>arrayreader function done<br>";

$tempobject "";
$tempobject $testreader->searchwordcase("testing.txt",'LINE');
print_r ($tempobject);
print 
"<br>search word case sensitive function done <br>";

$tempobject "";
$tempobject $testreader->searchwordnocase("testing.txt",'first LINE');
print_r($tempobject);
print 
"<br>search word case insensitive function done <br>";



print 
"<br><br> Ending code testing \n";





?>