[suspicious - maybe spam] note 49626 deleted from function.eval by tularis
| From: | tularis@php.net | Date: | Thu, 03 Feb 2005 11:09:44 +0000 |
| Subject: | [suspicious - maybe spam] note 49626 deleted from function.eval by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-84428@lists.php.net to get a copy of this message | ||
Note Submitter: nick at cope dot nl
Reason: bad code
----
To use eval as a template parser, use the following:
ob_start();
@eval('?>'.$textbody);
$textbody = ob_get_contents();
ob_end_clean();
With a suitable error handling function:
function myerrorhandler($errno, $errmsg, $filename, $linenum)
{
# Obey 'no error reporting' ('@'), but save the error
if (error_reporting() == 0)
$global_errors = rtrim($errmsg);
else
die("$filename:$linenum: Error $errno: $errmsg");
}
error_reporting(E_ALL);
set_error_handler('myerrorhandler');
you can display any warnings as well in the texts.