In the middle my HTML code, I have a line of PHP. now, I want to make PHP line as a comment.
I tried to ues <!-- -->
but it seems not work for PHP.
What should I do?
Thanks
Advertisement
Answer
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>