Comments in php code - Comments are part of PHP scripts not translated by the browser. The function of comments is only as a documentation of the PHP script that we make or a description of the script. A good comment is a short and not too long comment, but gives an explanation of what the code or variable is made of.
In PHP, program comments can use:
File Name: comment.php
Description: Program how to comment in PHP program.
Open notepad and then type the php code below.
<?php
/* These comments will not be printed on the screen
Which is also a comment
*/
// Well if this one line comments
# Keep this also a comment
echo "It will be printed on the screen";
?>
If the code has been typed, save it in the htdocs folder, and name it comment.php. To see the result, open the browser then type http://localhost/comment.php in the address bar. Then the result will look like the picture below.
So the article from me about comments in php code, hopefully the article can increase our knowledge of the php programming language. Also read article about: PHP Program Using Operators. Thanks.
In PHP, program comments can use:
- /* dan */
- // dan
- #
File Name: comment.php
Description: Program how to comment in PHP program.
Open notepad and then type the php code below.
<?php
/* These comments will not be printed on the screen
Which is also a comment
*/
// Well if this one line comments
# Keep this also a comment
echo "It will be printed on the screen";
?>
If the code has been typed, save it in the htdocs folder, and name it comment.php. To see the result, open the browser then type http://localhost/comment.php in the address bar. Then the result will look like the picture below.
![]() |
Program View |
So the article from me about comments in php code, hopefully the article can increase our knowledge of the php programming language. Also read article about: PHP Program Using Operators. Thanks.
Comments
Post a Comment