Monday, July 31, 2017

PHP Comment Block


A comment in PHP code is a line that is not executed as part of the program. Comment provide the short description about the particular piece source code.

Purpose of comment block are :

  • Provide the information to other programmer about the source code of program.
  • Remind yourself of what you did - Most programmers have experienced coming back to their own work a year or two later and having to re-figure out what they did. Comments can remind you of what you were thinking when you wrote the code.

Single Line Comments :
In PHP we can use the single line comment in two ways:
  1. // (C++ style single line comment)
  2. # (Unix Shell style single line comment)
<?php  
// this is C++ style single line comment  
# this is Unix Shell style single line comment  
echo "Welcome to PHP single line comments";  
?>

PHP Multi Line Comments

In PHP we can use the multiple line comment as follow:

<?php  
/* 
Write anything in
comment block
will not be displayed 
on the browser; 
*/  
echo "Welcome to PHP multi line comment";  
?>




No comments:

Post a Comment