PHP Comments

by Yogesh Khanna 01-Jul-16

1 3654


PHP comments are used to understand the functionality of the PHP code. One can easily distinguish the lines of code through comments. PHP language supports both single and multi-line comments. We can also hide the code through comments.

Following are the examples illustrating both single line and multi-line comments.

For Example:

<?php

// echo "What are you looking for?";
echo "Try this.";

?>

Example:

<?php

# echo "Or this";
echo "Hey! I'm here.";

?>

Above example is to comment only a single line. You can also use '//' and '#' to comment a single line.

To comment more lines, use this  /*  ....... */:

<?php

/*
echo "My name";
$name="Vihaan";
This is used to comment the paragraph or lines more than one.
*/

echo "Got it ?";

?


Share:


Comments

    No Comments Yet.

Leave a Reply