How can I comment out PHP lines inside HTML file?
You need to use PHP Comments not HTML comments <!-- -->
Note that you should hide PHP code for security reasons when commenting out a chunk of HTML containing PHP code using <!-- -->
otherwise your source code will be visible when page is viewed.
Imagine you have the following code:
<body>
<?php echo $this_variable_will_echo_a_div; ?>
</body>
If you want the div to be echoed but not displayed at the page, you'll comment html, PHP still gets executed:
<body>
<!-- <?php echo $this_variable_will_echo_a_div; ?> -->
</body>
If you don't want the div to appear at the source as commented html, you'll have to comment php, nothing will appear between the body tags at your source:
<body>
<?php /* echo $this_variable_will_echo_a_div; */ ?>
</body>
All the commenting methods of PHP syntax works in the embedded code inside HTML. Feel free to use anyone.
<?php //for one line comment ?>
<?php /* for multi-lines comment */ ?>
also you can use the HTML comment syntax just outside the php tags.
<!-- <?php blah blah ?> -->
Note that the PHP code will still be executed.