File: FileScopeReplacer/script_test.php

Recommend this page to a friend!
  Classes of Ilya Nemihin  >  File Scope Replacer  >  FileScopeReplacer/script_test.php  >  Download  
File: FileScopeReplacer/script_test.php
Role: Example script
Content type: text/plain
Description: Usage example
Class: File Scope Replacer
Find and replace data in files in directories
Author: By
Last change:
Date: 16 years ago
Size: 992 bytes


Class file image Download


$params = array();

//--------------- configuration --------------

// directory where files will be searched to replace
$params['dir'] = '.';

// set to 1 if you want to proceed also nested directories
$params['include_nested'] = 0;

// this is string of what you are looking for
$params['search_what'] = 'test';

$params['replace_to'] = '[this place have been replaced]';

// setting for filtering, set '' if no filtering,
// otherwise thi is regexp expression like: '/your_regexp/flags',
// see
$params['file_name_match'] = '/^test/'; // <-- this mean beginning from 'test'

//--------------- end configuration --------------

$replacer = new FileScopeReplacer( $params );

'Was processed '.count($replacer->processed_files).' file(s).'."\n";
$replacer->processed_files as $file_path ){


For more information send a message to info at phpclasses dot org.