What is the purpose of ob_start() in PHP and how does it affect output buffering?

The purpose of ob_start() in PHP is to turn on output buffering. This means that instead of sending output directly to the browser, the output is stored in an internal buffer. This can be useful for manipulating output before sending it to the browser, such as modifying headers or content.

<?php
ob_start();

// Your PHP code here

ob_end_flush();
?>