In any programming language it may be php, java, html or any other programming language, commenting is the most basic requirement to optimize your code for future use.Comments in between your code not only make this snippet understandable to you but also may help others to understand your code .If after an year you needs to edit in your code then only comments can give you the same thinking as you had when you code this before an year.
Comments are very good practice during your code it can reduce your maintenance efforts. Php supports mainly two type of comments.
Comments are very good practice during your code it can reduce your maintenance efforts. Php supports mainly two type of comments.
- Single Line Comment
- Multi line comment
Single Line Comment
Single line comment used to comment the content from an single line only and the syntax for single line comments is as follows.
<?php //this is single line comment in php ?>
Or
Multi Line Comment
Multi line comments used to comment multiple line simultaneously, If you needs to comment an block of code together then these multi line of code can be used such as follows.
<?php /* this is first line of multiline comment this is second line of multiline comment this is third line of multiline comment */ ?>
These comments can help you as the notes in your code, and very necessary to understand and think same about your code as you had think when you write this block of code.