Skip to main content

What is output buffering in PHP?

Junior PHP
Quick Answer Output buffering stores PHP output in memory instead of sending it directly to the browser. ob_start() starts buffering. ob_get_clean() returns the buffered content and clears it. Benefits: lets you set headers after output begins, manipulate output before sending, compress responses. Frameworks use it to wrap layout templates around content.

Answer

Output buffering stores output in a buffer so headers can be modified and output order can be controlled.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice