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!.

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

Arjun
I am Arjun from Hyderabad (India). I have been working as a software engineer from last 7+ years, and its my passion to learn new things and implement them as a practice. Aside from work, I likes gardening and spending time with pets.
DMCA.com Protection Status