I would like to surround some PHP code with some other code that captures the output that would normally go to STDOUT. I am looking for something functionally equivalent to the following:
startCapturing(); // STDOUT will go to $CAPTURED_STDOUT
echo "Hello world!";
stopCapturing(); // $CAPTURED_STDOUT contains "Hello world!"
Is this possible in any way with PHP? Oh, I am using PHP 4.x.x by the way.
Thanks,
~ Justin