PHP Comment
1 - Single line comment
2 - Multiline comment
Why Use Comment
Comment are used to stop the execution of code
Write comment to help for new developer
Single line comment
<?php
// $string = "Hello boss how are you";
$str = " Hello how are you";
echo $str;
#This is also single line comment
?>
Multi-line comment
<?php
$string = "Hello PHP ";
/* **This is multi-line comment
and $string is a variable
****/
echo $string;
?>
Use comment in function
<?php
$string = "php is server side language";
function myFunction(){
// echo $string; it geenerate an error
echo "php run on server ";
}
myFunction();
?>
Result
php run on server
If you want to know why generate error you should learn PHP Variable