Theoretical Paper
- Computer Organization
- Data Structure
- Digital Electronics
- Object Oriented Programming
- Discrete Mathematics
- Graph Theory
- Operating Systems
- Software Engineering
- Computer Graphics
- Database Management System
- Operation Research
- Computer Networking
- Image Processing
- Internet Technologies
- Micro Processor
- E-Commerce & ERP
Practical Paper
Industrial Training
PHP Comments
Comments in PHP
A comment in PHP code is a line that is not executed as a part of the program. Its only purpose is to be read by someone who is looking at the code.
Comments can be used to:
- Let others understand your code
- 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 several ways of commenting:
Example
Syntax for single-line comments:
< !DOCTYPE class="attributecolor" style="color:red"> html="tagcolor" style="color:mediumblue">> < html class="tagcolor" style="color:mediumblue">> < body class="tagcolor" style="color:mediumblue">> < ?php class="phpnumbercolor" style="color:red"> class="commentcolor" style="color:green"> // This is a single-line comment class="phpnumbercolor" style="color:red"> class="commentcolor" style="color:green"> # This is also a single-line comment class="phptagcolor" style="color:red">?> < /body class="tagcolor" style="color:mediumblue">> < /html class="tagcolor" style="color:mediumblue">>
Example
Syntax for multiple-line comments:
< !DOCTYPE class="attributecolor" style="color:red"> html="tagcolor" style="color:mediumblue">> < html class="tagcolor" style="color:mediumblue">> < body class="tagcolor" style="color:mediumblue">> < ?php class="phpnumbercolor" style="color:red"> class="commentcolor" style="color:green">/* This is a multiple-lines comment block that spans over multiple lines */ class="phptagcolor" style="color:red">?> < /body class="tagcolor" style="color:mediumblue">> < /html class="tagcolor" style="color:mediumblue">>Example
Using comments to leave out parts of the code:
< !DOCTYPE class="attributecolor" style="color:red"> html="tagcolor" style="color:mediumblue">> < html class="tagcolor" style="color:mediumblue">> < body class="tagcolor" style="color:mediumblue">> < ?php class="phpnumbercolor" style="color:red"> class="commentcolor" style="color:green"> // You can also use comments to leave out parts of a code line $x = class="phpnumbercolor" style="color:red">5 class="commentcolor" style="color:green"> /* + 15 */ + class="phpnumbercolor" style="color:red">5; class="phpkeywordcolor" style="color:mediumblue">echo $x; class="phptagcolor" style="color:red">?> < /body class="tagcolor" style="color:mediumblue">> < /html class="tagcolor" style="color:mediumblue">>