Stop and return the output buffer at the same time


Once I have started output buffering with ob_start(), I would like, in one command, to stop the output buffering and get its content (without sending it to the output). I reviewed the available functions, and my understanding of each function is as follows:

                 clear  return  send    stop
ob_clean          x
ob_end_clean      x                      x
ob_end_flush                      x      x
ob_flush                          x
ob_get_clean      x        x             x  // should be called ob_get_end_clean
ob_get_contents            x
ob_get_flush               x      x

As far as I can see, there isn't a function which returns the output after stopping the buffering, so when I want to capture the output of a function I have to do it in 3 steps:

$output = ob_get_contents();
return $output;

Am I missing something or is there a command to stop and return the output buffer in one go?

To say it with the manual:

ob_get_clean() essentially executes both ob_get_contents() and ob_end_clean().

(highlight by me). Comparing with your code:

$output = ob_get_contents();

Your listing must have missed something.