In what situations should PHP code be enclosed in <?php tags to prevent it from being ignored or commented out?

When embedding PHP code within an HTML file, it is essential to enclose the PHP code within <?php ?> tags to prevent it from being ignored or commented out. Without these tags, the PHP interpreter will not recognize the code as PHP and will treat it as regular HTML, resulting in the code not being executed.

&lt;?php
// PHP code here
?&gt;