Difference between ob_get_clean and ob_get_flush

EEka picture EEka · Sep 11, 2011 · Viewed 19.9k times · Source

They both seem to do the same thing: return the output buffer content to you and delete it aftewards.

Which one should I use?

Answer

Arnaud Le Blanc picture Arnaud Le Blanc · Sep 11, 2011

ob_get_clean() removes the buffer (without printing it), and returns its content.

ob_get_flush() prints the buffer, removes it, and returns its content.

Both function will terminate the buffer.