note 76339 deleted from function.eval by danbrown

From: Date: Sun, 17 May 2009 19:53:53 +0000
Subject: note 76339 deleted from function.eval by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-155289@lists.php.net to get a copy of this message
Note Submitter: nicolas_rainardNOSPAM at yahoo dot fr ---- Ever whished to evaluate an external file as a PHP script and get the result as string? Exemple: 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. You can do this: <?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(); } ?> It *should* work without problem if the caller script already uses output buffering, since output buffers are stackable (not tested yet).

« previous php.notes (#155289) next »