We can use PHP Comments to explain the PHP code to others. Comments are ignored by the PHP Interpreter and the web browser.
Single Line Comment
Single line comment can be added in PHP code using the double forward slash //.
// This is single line PHP comment
We can also use multi-line comments in PHP Code. To start a multi line comment, a forward slash and an asterisk (/*) is used. To end it an asterisk and a forward slash (*/) is used.
/* This is a multi line comment in PHP example
This will be ignored by the PHP interpreter
and the web browser */
PHP Comment Demo
<title>PHP Comment Demo</title>
<h1> PHP Comment Demo </h1>
//Sample PHP Code single Line comment
echo “Hello, This page can run PHP code! \n”;
This is a multi-line PHP comment.
Both the single-line and multi-line comments
would be ignored by PHP preprocessor and
echo “\n Notice that none of the PHP comments will appear here..”;
<h1>PHP Tutorials </h1>
Code Editors generally highlight comments in different color to visually separate it from the code.
Notice that none of the comments are displayed by the browser.
PHP Tutorials on this website:
More Information on PHP