The PHP comment syntax always begins with a special character sequence and all text that appears between the start of the comment and the end will be ignored.
The single-line comment tells the interpreter to ignore everything that occurs on that line to the right of the comment. To do a single line comment type "//" or "#" and all text to the right will be ignored by the PHP interpreter.
There are two ways to use single-line comments in PHP.
// (C++ style single line comment)
# (Unix Shell-style single line comment)
Example 1:
<?php
// this is Php and C++ style single line comment
echo "Welcome to PHP single line comments Example";
?>
Output : Welcome to PHP single line comments Example
In PHP, we can comments on multiple lines also. To do so, we need to enclose all lines within /* */. Let's see a simple example of a PHP multiple line comment.
<?php
/*
Anything placed
within comment
will not be displayed
on the browser;
*/
echo "Welcome to PHP multi line comment Example";
?>
Output : Welcome to PHP multi line comment
© 2024 Easy To Learning. All Rights Reserved | Design by Easy To Learning