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: /* .....
// If one want to use to comment in their particular code segment then use like this
$x = PHP /* Stands for */ stand for;
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
<title>Add Two Numbers in PHP</title>
/* PHP program to
* add two numbers */
//declared and initialized variable a
$a = 5;
//declared and initialized variable b
$b = 6;
//added variable a and b and stored in sum
$sum = $a + $b;
//printing the sum value in browser
echo "sum is $sum";
Above program shows addition in PHP
sum is 11