note 11465 deleted from function.ob-start by sniper
| From: | sniper@php.net | Date: | Tue, 25 Feb 2003 08:15:48 +0000 |
| Subject: | note 11465 deleted from function.ob-start by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-44481@lists.php.net to get a copy of this message | ||
For those who are not the master of their httpd, thus making it impossible to replace old PHP3 by
PHP4, here's a little turn around... if you want to get all the echo... from a program. (ok,
with ob,you get the errors, but hey...)
/* This is for PHP 3.0, where out buffers are not born */
$program = "\$temptempl=\"\";".$program;
$program = str_replace("echo","\$temptempl .= ",$program);
$program .= "define(\"TMPTMPL\", \"\$temptempl\");";
eval($program);
$contents = TMPTMPL;
/* This is for PHP 4.0 */
ob_start();
eval($program);
$contents = ob_get_contents();
ob_end_clean();