How to add comments in php code or html code, ignore single line or multiple lines

add-comments-to-php-code-and-html-code-gotitnow
Share This !

Adding comments to PHP code or HTML code for understanding the code is quite easy, this method will also help to ignore single line of code or multiple line of codes while testing your code.

Adding comments to HTML CODE

To add comments to HTML CODE use below syntax –

<!– Add your comments here –>

Adding comments to PHP CODE

  1. To add comments to single line “//” or “#”

for e.g.

PHP CODE – 

<?php
echo “What is my name”; // This will display the sentence
// echo “I am scholar”;
# echo “I sleep on time”;
?>

OUTPUT WILL BE –

What is my name

2. To add comments to multiple line of code in php follow below method –

PHP CODE – 

<?php

/* echo “What is my name”;
echo “I am scholar”;
echo “I sleep on time”; */

echo “I want to learn more”;
?>

OUTPUT WILL BE –

I want to learn more

I hope above explanation will help you.

Tagged with: , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*