What are the best practices for including external PHP scripts in HTML documents to ensure proper functionality?

When including external PHP scripts in HTML documents, it is important to ensure that the PHP code is executed properly and that any variables or functions are accessible within the HTML. To achieve this, it is recommended to use the `include` or `require` functions in PHP to include the external script within the HTML document. This will ensure that the PHP code is executed and any output is displayed correctly on the webpage.

<?php
include 'external_script.php';
?>