Snippet Name: EVAL a file
Description: Evaluate an external file as a PHP script and get the result as string. For example, you'd like to get the contents (and all PHP output) of a (text|XML|HTML) file after having processed whatever PHP inclusion it may contain, to further process these contents.
Comment: (none)
Language: PHP
Highlight Mode: PHP
Last Modified: February 27th, 2009
|
<?PHP
$str = compile('file_to_process');
$str = do_more_things_with($str);
ECHO $str;
FUNCTION compile($file) {
OB_START();
REQUIRE $file;
RETURN OB_GET_CLEAN();
}
?> |