Head Ads

How to comment in Php | Comments php wordpress

Share:

How to comment in Php Single Line and Multiple lines | Comments PHP WordPress

How to comment in Php
How to comment in Php

Just assume we write code and when we write code then everything goes good but after sometimes you realize you need some changes in the code. How to comment in Php, Or you assign this work to other programmers to make changes in the code. At this time you will have to find code and other programmers will have to do so and this will makes work very difficult for you people.  If you use code in your coding this will be very easy to find the codes and where you have to change your code. A good programmer has a quality that he puts comments in his coding. How to comment in Php learn with easy steps.

What you will learn in this article 

In this article, I will discuss how to comment on the code using PHP programming language, how to comment on a single line code. I will also discuss multiline comments in PHP code. I will also provide you examples of one line and multiline. In the end, I will give you solid reasons why you need comments uses of comments in the PHP code. How to comment in Php and many other topics.

What is the comment in the code? How to comment in Php

Let me clear your concepts about a comment, a comment is a text in the code which PHP servers ignore these text and for the readers of code, it gives clear idea about what this code is written.

How to comment in Php on a single line

If you want to comment in a single line in PHP then we use forward slashes at the start of the line and then write the comment or we can also use hash at the start of the line text and then put your comment text.
  • Examples of one-line comments

// This is PHP one-line comment that is using double backslashes
# This is PHP one-line comment that is using a hash
  • How to comment in the multiline comment in your PHP code

If you have a text that is more than one line than you can comment on this text using a multiline comment in PHP code. If you want to comment multiline then use forward slash and asterisk /* in your start before comment text and at the end of comment text asterisk and forward stash */ at the end of the text for better understanding

see the following example of How to comment in Php

/*
I am Saeed a website developer who developed many websites with PHP and using other platforms of PHP frameworks like WordPress, core PHP, and many more. I have very good experience in WordPress theme development; Theme customization and editing in theme core PHP file any change in the theme function files etc.
*/

USES of comment in PHP code

  • Better understanding the code 

You can use the comment in your PHP file for the better understanding of the code uses in PHP files there are thousands of line code on a file if you make sections and write comments your code this will make better understandings of your code whenever want to modify the file.
  • Time-saving in the coding

The comments will save your time to understand the code and you can work in a short time seeing your code in PHP files.
  • Not to run PHP code

If you don’t want to run you some of PHP code in your file then you can comment on the code section. That you don’t want to run. This will not run and for the future times this if you want to use the code. Then you can use it in the future time.

Final words about How to comment in Php

Php comments are very useful in the sense of understanding your complete code file. And the section where you want to make a change.  Comments make your life easier and this saves you’re a lot of time.

Give me feedback on How to comment in Php

If you like this article please comment and gives me feedback in the comment section. If you need any help regarding PHP coding I can provide you just let me know in your comment. I will discuss in the next post thanks.
Please read an article about comments in PHP code
First article post link
Second article post link
Third article post link

3 comments:

  1. zielonyflaming.pl Unbelievably individual friendly website. Immense info available on couple of clicks on.

    ReplyDelete
  2. https://nutrisolutions.pl You have one of the best web pages.

    ReplyDelete
  3. natury-smak.pl Astonishingly user friendly website. Immense information available on couple of gos to.

    ReplyDelete

Note: Only a member of this blog may post a comment.