Post Page Advertisement [Top]



Click here to send WhatsApp On Unsaved Mobile Numbers

Comment in PhP with examples
Comment in PhP with examples

Comment in PHP with examples.

In any programming language comment is just a line that is not executed as the part of the program. Like this PhP comments are, also be, just some lines in the program which are not to be executed as the part of the PhP programming. Comments are only for reading purpose by the coder or developer.

Comments are not executed with the program so why it is necessary? Is writing comment in the program is necessary? There are lots of questions arises in our mind.
-
-
The simple answer of these all types of question is that, it is very very important with hundred  thousands lines of code. It is not important to write comment if there is only few lines of code in the program. Otherwise you can say that it is totally dependent on programmer to write the comment or does not write the comment in the program. But, it is best practice to write comments in programs. 

Comments are important because of understanding the code by anyone. Once you or any other developer write hundred thousands lines of code in a program then it is very hard to understand the code again after few months or year. That's why we need to write the comments in the program to understand our code again after few months. Comment also helps other developer to understand the others code. 

It is also very important to write a meaningful comments in the program. And, also we have to take care of that the comment is related to the code for which code we write the comment.

There are different way to comment in a PhP program or other program.

Comment syntax in PHP:

-
-
<?php
    // This is a single-line comment
    # This is also a single-line comment

   /*
      This is a multiple lines comment block
                which starts with /* and ends with */
   */
?> 

Some examples: (PHP Comment examples)


PHP Comment Example 1:
<?php 
    # Hello World program in PHP.
    echo "Hello World!!!"; // This is hello world program in php
?> 

Output:
Hello World!!!


PHP Comment Example 1:
<?php 
    /* Multi-line comment is start with a asterisk symbol followed by forward slash
       and, ends with backslash followed by a asterisk symbol.
       Adding two numbers in php.
    */
    $a = 2;
    $b = 3;
    $c = $a + $b; # adding two numbers in php
    echo $c;
?> 

Output:
5


Click here to learn more in PHP

-
-
---
I hope you likable this nice post. Do not forget to share it together with your friends, the Sharing Button is below the post. Apart from this, if there's any downside within the intermediate, don't hesitate to request the Comment Box. we are going to be happy to help you.

I will continue to write more and more on this blog, so do not forget to make our blog BlogLearner as a bookmark (Ctrl + D) on your mobile or computer and subscribe to us to get all the posts in your email. Do not forget to share these posts, if you like it. You can facilitate us reach additional individuals by sharing it on social networking sites like Facebook or Twitter.

thankyou-rrkksinha-bloglearner
Comment in PHP with examples.
#rrkksinha #bloglearner #comment_in_php

No comments:

Post a Comment

Bottom Ad [Post Page]

rrkksinha.