PHP Classes

File: tests/preproc.php

Recommend this page to a friend!
  Classes of Alexander Selifonov   PHP Code Preprocessor   tests/preproc.php   Download  
File: tests/preproc.php
Role: Example script
Content type: text/plain
Description: Using example
Class: PHP Code Preprocessor
Preprocess code or text like in the C language
Author: By
Last change: fixed files
Date: 8 years ago
Size: 621 bytes
 

Contents

Class file image Download
<?php
/**
* Testing class.preProcessor.php functionality
*/
include '../src/class.codePreprocessor.php';
$srcfile = 'source_example.txt';

$myvars = array(
 
'use_auth' => FALSE
 
,'my_auth' => 1
 
,'sw_lang' => 'de'
 
,'program_title' => 'Sample string to demonstrate %var% substitution in Preprocessor'
);

$preproc = new CodePreprocessor();
$preproc->setLF('unix');

echo
"Preprocessed text:\n-----------------------------------------\n";
echo (
$preproc -> parse($srcfile, $myvars, TRUE));

echo
"\n-----------------------------------------\nError/warning messages:\n";
echo
implode("\n", $preproc->getErrorMessages());