PHP supports nesting ob_start() elements. This is a very new discovery. :) And a pleasant one. :)
Example:
ob_start();
ob_start();
echo 'abc...';
$c1 = ob_get_contents();
ob_end_clean();
echo 'def...' . $c1;
$c2 = ob_get_contents();
ob_end_clean();
echo $c2;
PHP Manual:
Output buffers are stackable, that is, you may call ob_start() while another ob_start() is active. Just make sure that you call ob_end_flush() the appropriate number of times. If multiple output callback functions are active, output is being filtered sequentially through each of them in nesting order.
No comments:
Post a Comment