In what scenarios can using PHP code within an HTML document cause issues, and how can these be resolved to ensure proper functionality?
Using PHP code within an HTML document can cause issues when the PHP code is not properly parsed or executed. To ensure proper functionality, make sure that the PHP code is enclosed within `<?php ?>` tags and that the file extension is `.php` instead of `.html`.
<?php
// Your PHP code here
?>