<?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";
?>
|