How to Comment in PHP
C style commentUNIX style commentSingle line PHP style comment
Edited by Nikunj Gandhi, Zach, Ned Whitney, Maniac and 1 other
Edit Steps
-
1A Comment in PHP is part of a script which is ignored by the web server while executing PHP scripts.Ad
-
2A comment is the portion of a program that exists only for the human reader. Comments are used for helping the next person who reads your code figure out what you were thinking when you wrote it.
-
3There are three types comment in PHP.
EditMethod 1 of 3: C style comment
EditMethod 2 of 3: UNIX style comment
EditMethod 3 of 3: Single line PHP style comment
Edit Tips
- HTML comments and PHP comments are both different, so when you are using scripting(HTML and PHP mix), take care of PHP execution.
- For example, in the below code, there is an HTML comment, but it still executes.
<!--<div id="example"><?php echo 'hello'; ?></div>-->
Article Info
Thanks to all authors for creating a page that has been read 977 times.