By comment it means that the developers do not want to execute that particular code.
It is generally to test that this particular code is running properly or not.
Single line comment: //
Multiline comment: /* .....
... */
Example:
/*Multiple Line Comment */ // If one want to use to comment in their particular code segment then use like this $x = PHP /* Stands for */ stand for; echo $x; ?>
Result:
PHP stand for
Explanation: If one want to comment a single line then they can use either – “//” or “#” or if one want to comment multiple line then they can use- “/* —code—-*/”
And in the last part you must have seen that particular section has been commented so that part would not be seen by anyone and result would be that part that is not commented.
Write a PHP program to add two numbers. Use appropriate comment when required.
addition program in php is very simple.
- Take two variables and give them initial value
- Add both variables and store in another variable
- print the sum
Add Two Numbers in PHP
Above program shows addition in PHP
Output
sum is 11