note 11465 added to ob_start

From: Date: Wed, 21 Feb 2001 21:57:04 +0000
Subject: note 11465 added to ob_start
Groups: php.notes 
Request: Send a blank email to php-notes+get-11380@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(); http://www.php.net/manual/en/function.ob-start.php

« previous php.notes (#11380) next »