How can PHP code within included files affect the output when using ob_start() and ob_get_contents()?

When using ob_start() and ob_get_contents() to capture output, any PHP code within included files will be executed and affect the final output. To prevent this, you can use ob_clean() before including the files to clear any existing output buffers.

ob_start();
ob_clean();
include 'your_included_file.php';
$output = ob_get_contents();
ob_end_clean();
echo $output;