Help Me/Question What Is The Need Of Comments In Php?

Doominic anderson

Yellow Belt
We all know that PHP allows us to create dynamic web pages by embedding PHP scripts in an HTML. Page using the "<?php ?> tags".
There are many concepts of PHP which are used to make the web page user friendly like Variables,Strings,Comments,Arrays,Operators e.t.c.
What is the use of Comments in PHP, why it is he need of Comments in PHP?

Manish Mishra

Yellow Belt
It makes you doing very friendly coding for your own convenience. If you write comments along with the codes you are making it simpler for the other people to understand how the things have been done.

Also, it may help a lot for the beginner programmer to understand some coding part with the help of comments. It gives a good structure and making you well understanding with the coding. For few parts that you may like to change you can add such comments for later changes.


Yellow Belt
There are so many comments are available in PHP such as:-
/*......... .......... ..............*/ (Multi line comment).
//............. .............. (single line comment)
Comments is the very useful to understand the code of PHP for PHP programmer.
Suppose you are a PHP programmer and you work on a php project but you can not understand their code it is only the reason that is Comments. So comments is very important in all programming.

steve taylor

Yellow Belt
Comment and description of code makes whole program to readable. Any programmer can easily read and understand the program. In the modern programming languages existing code are used again and again so here readability is required to perform some small changes according to need in the existing program code.


Yellow Belt
A comment is a part of code that is not executable . Its purpose is to be read by someone who is editing the code.
  1. To make code easily understandable to others: The comments make the other programmers easily understand what you were doing . This makes easier for them to work on it, and to edit it.
  2. For self understanding: we have always experienced coming back to edit our own work a year or two later and have to review whole code to figure out what we did. Comments can remind us of what we were thinking, to avoid having to understand our own workings.
Last edited: