Login   Register  
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 Heyes  >  Search and Replace  >  example.php  >  Download  
File: example.php
Role: ???
Content type: text/plain
Description: An example script utilising the class.
Class: Search and Replace
Author: By
Last change:
Date: 2000-09-10 18:43
Size: 1,096 bytes
 

Contents

Class file image Download
<?php
/***************************************
** Title........: Search and Replace class
** Filename.....: example.php
** Author.......: Richard Heyes
** Version......: See script
** Notes........:
** Last changed.: 10/09/2000
** Last change..:
***************************************/

        include('class.search_replace.inc');

/***************************************
** Create the object, set the search
** function and run it. Then change the
** pattern to find, and re-run the search.
***************************************/

        $sr = new search_replace('test', 'Replaced!', array('test.txt'));
        $sr->set_search_function('quick');
        $sr->do_search();

        $sr->set_find('another');
        $sr->do_search();

/***************************************
** Some ouput purely for the example.
***************************************/

        header('Content-Type: text/plain');
        echo 'Number of occurences found: '.$sr->get_num_occurences()."\r\n";
        echo 'Error message.............: '.$sr->get_last_error()."\r\n";

?>