What are some common pitfalls when using output buffering in PHP, and how can they affect performance?

One common pitfall when using output buffering in PHP is forgetting to call ob_end_flush() or ob_end_clean() at the end of the script, which can lead to unexpected output behavior and potential memory leaks. To avoid this issue, always make sure to properly close the output buffer after using it.

<?php
ob_start();

// Your PHP code here

$output = ob_get_clean();
echo $output;
?>