PHP: Comments
Read Time:46 Second
In addition to code, source code files may contain comments. This is text that is not part of the program and is needed by programmers for notes. They are used to add explanations of how the code works, what errors need to be fixed or something to remember to add later.
Comments in PHP come in two flavors:
Single-line comments
Single-line comments begin with //. These characters can be followed by any text, the whole line will not be parsed and executed.
Comments can take up an entire line. If one line is not enough, several comments are created:
<?php
// For Winterfell!
// For Lanisters!
The comment may be on a line after some code:
Multi-line comments
Multiline comments begin with /* and end with */. In between each line must begin with a *.
<?php
/*
* The night is dark and
* full of terrors.
*/
print_r('I am the King');
0
0
Average Rating