Skip to content

How to Comment Your PHP Code?

PHP allows three different methods of formatting comments. Comments are generally known as single line and multiple line Comments.A comment in PHP code is a line that is not read as part of the program. Its only purpose is to be read by someone who is editing the code.

Comments are really helpful for us to remind our self what we did in the code, and it will help others to know what you’re doing.

So how do you add comments into your PHP code?

The first is by using // to comment out a line. This method is know as single line comments. Here is an example:

 

The second is by using # to comment out a line. This method is know as single line comments. Here is an example:

 

The last one is by using /* */ to comment out multiple lines. This method is know as multi line comments. Here is an example:

 

That’s is it!.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments