Comments in PHP Code

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:
  1. /* dan */
  2. // dan
  3. #
To better understand it, here I give an example of a comment in a php program code.
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";
?>
Comments in PHP Code


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