I just discovered, with my great surprise, that I can't use ob_ functions inside a user defined function and call this function more than once, because the second output never comes out
Here are my simplified files
index.php
function foo($data){
ob_start();
require_once("tpl.php");
$html = ob_get_clean();
return $html;
}
echo foo('Hello');
echo foo('World!');
tpl.php
<p>and now I say... <?php echo $data; ?><p>
I'd expect this output:
and now I say... Hello
and now I say... World!
Instead, I get only this:
and now I say... Hello
Where am I wrong? Is there something I'm missing? I'm with PHP 5.3... Thank you in advance