note 71437 deleted from function.eval by colder
| From: | colder@php.net | Date: | Wed, 29 Nov 2006 07:43:19 +0000 |
| Subject: | note 71437 deleted from function.eval by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-120152@lists.php.net to get a copy of this message | ||
Note Submitter: holger at doessing dot net
Reason: bad code
----
This is a variation on Dale's code, however, this will allow you to parse php within any type
of file - yes, I actually found a use for this ;)
<?php
flush(); // send/empty current buffer (however, see ob_flush() if you experience problems)
ob_start(); // start recording
eval("?>".file_get_contents("stuff.foo")); // break out from php mode, but
evaluate any php code present in the file
$stuff = ob_get_contents(); // grab output buffer and treat as string
ob_end_clean(); // discard buffer and stop buffering
?>