What is the purpose of buffering output in PHP and how can it be compressed using ob_gzhandler?

Buffering output in PHP allows you to store the output in a buffer before sending it to the client, which can improve performance by reducing the number of HTTP requests. To compress the output using ob_gzhandler, you can enable output buffering and set the ob_start() function with ob_gzhandler as a parameter.

<?php
ob_start("ob_gzhandler");
echo "This is a compressed output using ob_gzhandler!";
ob_end_flush();
?>