How can OutputBuffering be used to optimize the loading of a PHP webpage with multiple database queries?

Output buffering can be used to optimize the loading of a PHP webpage with multiple database queries by capturing the output generated by the queries and sending it to the browser all at once, instead of in multiple smaller chunks. This can help reduce the number of round trips between the server and the browser, resulting in faster loading times for the webpage.

<?php
ob_start(); // Start output buffering

// Perform multiple database queries here

// Output the content of the queries
echo $query1_output;
echo $query2_output;
echo $query3_output;

ob_end_flush(); // Flush the output buffer and send it to the browser
?>