The PHP comment always begins with a special characters and all text that appears between of the comment will be ignored.
There are two types of comments.
- Single line comment
- Multiple line comment
Single line comment - will begin with "\\" or "#" symbols, and all text on right will be ignored !
echo "Hello W3docs!"; // This will output Hello W3docs! // echo "This is comment!"; (This will not output) # echo "This is comment, too !"; (This will not output)
Multiple line comment - begins with " /* " and ends with " */ " , and all text between that symbols will be ignored.
/* This is multiple line comments and all this text will be ignored */
Nested comments are not allowed , and will cause an error !
/* This is multiple line comments /* This comment is not allowed */ and all this text will be ignored */