0

I have some code which does the following:

<?php
ob_flush();
ob_start();
echo $something;
ob_end_flush();

echo $another_thing;
?>

I can see $something but not $another_thing;

According to the manual ob_end_flush() just turns off output buffering, so if that's the case, why can't I see $another_thing; just the same as if I'd written without any output buffering:

<?php
echo $something;
echo $another_thing;
?>

Although I saw no reason why this should work, I decided to try calling flush() and ob_flush() after echo $another_thing; but this didn't help either.

What is the correct way to do this, and why doesn't the above work?

Thanks

ec2011
  • 570
  • 6
  • 20

1 Answers1

0

Turns out that the problem was elsewhere!

In the course of setting $something; above I was calling a series of functions in a big template and somewhere buried in there was an exit statement, so the problem was nothing to do with output buffering!

ec2011
  • 570
  • 6
  • 20