Page Stats
Visitor: 671
PHP Comment
A PHP comment is a line that is written in between the PHP file but not read/execute by the server. The main purpose of comment is to understand what you are doing, or Remind yourself of what you did - Most programmers have experienced coming back to their own work a year or two later and having to re-figure out what they did. Comments can remind you of what you were thinking when you wrote the code. PHP supports 2 type of comments:
- Single-line Comment:If you want to write a comment in one line than single-line comment is used. It is applied using two forward slashes or with a # symbol.
// - This is a single-line comment
# - This is also a single-line comment - Multi-line Comment: If you want to write a comment for 2 or more lines that multi-line is used. It is start with forward slash and a asterisk and end by asterisk and a backward slash. /* This is a Multi-line comment */
Example 1: Single-line and Multi-line comment
<?php echo "Comments in PHP"; //echo "This is a Single Line Comment and will not be displayed"; #echo "This is also a Single Line Comment and not displayed."; /* echo "This is multiline comment."; echo "This line will not display"; echo "This line is also a comment will not be displayed"; */ ?>