Answered by : lokesh-kumar-suman
// This is a single-line comment
# This is also a single-line comment
/*
This is a multiple-lines comment block
that spans over multiple
lines
*/
Source : | Last Update : Wed, 10 Mar 21
Answered by : balaji-thulasiraj
<?php
// This is a single-line comment
# This is also a single-line comment
/*
This is a multiple-lines comment block
that spans over multiple
lines
*/
// You can also use comments to leave out parts of a code line
$x = 5 /* + 15 */ + 5;
echo $x;
?>
Source : | Last Update : Thu, 07 May 20
Answered by : samy
<?php
// Author : https://www.codedweb.org/
// This is a single-line comment
# This is also a single-line comment in unix and linux
/*
This is a Multi-lines comment block
by this way you can add muliple lines on it.
lines
*/
// You can also use comments to leave out parts of a code line
$var = 2 /* + 12 */ + 2;
echo $var;
?>
Source : | Last Update : Wed, 17 Jun 20
Answered by : mirsho
/** * Does something interesting * * @param Place $where Where something interesting takes place * @param integer $repeat How many times something interesting should happen * * @throws Some_Exception_Class If something interesting cannot happen * @author Monkey Coder <[email protected]> * * @return Status */
Source : https://stackoverflow.com/questions/1310050/php-function-comments | Last Update : Thu, 19 Aug 21
Answered by : hamza-bin-sajid
<?php
/*
echo 'This is a test'; /* This comment will cause a problem */
*/
?>
Source : https://www.php.net/manual/en/language.basic-syntax.comments.php | Last Update : Sat, 24 Oct 20
Answered by : code-grepper
// I'm a single, line comment
# I am another single line comments using #
/* And I am a multiline comment
*/
Source : | Last Update : Mon, 08 Jul 19
Answered by : fede
//For a single line comment use //:
//this is a comment too
//for multi-line comments use /* and */:
/* <--start of multi-line comment
this is a comment
this is a comment too (end of multi-line comment)-->*/
Source : | Last Update : Sat, 21 Mar 20
Answered by : hamza-bin-sajid
A nice way to toggle the commenting of blocks of code can be done by mixing the two comment styles:
<?php
//*
if ($foo) {
echo $bar;
}
// */
sort($morecode);
?>
Now by taking out one / on the first line..
<?php
/*
if ($foo) {
echo $bar;
}
// */
sort($morecode);
?>
..the block is suddenly commented out.
This works because a /* .. */ overrides //. You can even "flip" two blocks, like this:
<?php
//*
if ($foo) {
echo $bar;
}
/*/
if ($bar) {
echo $foo;
}
// */
?>
vs
<?php
/*
if ($foo) {
echo $bar;
}
/*/
if ($bar) {
echo $foo;
}
// */
?>
Source : https://www.php.net/manual/en/language.basic-syntax.comments.php | Last Update : Sat, 24 Oct 20
Answered by : iamatp-on-scratch
/*There are two types of comments:
1) Spans over multiple lines - Multiple-line comment
2) Spans over one line only - Sinlge-line comment
*/
/* There are two ways to write a single-line comment:
1) Using double slash
2) Using the hash tag
*/
// This is an example of single-line comment using double slash
# This is an example of single-line comment using hash tag
/*There is only one way of using multiple line comments, startin with the
slash and asterisk respectively, and ending with asterisk and slash
respectively */
Source : | Last Update : Fri, 17 Jun 22
Answered by : pierre-joubert
/** * This function compiles a message that tells you how great coffee is * * @param string $compliment A nice word to describe coffee * @param integer $score A score out of 10 */
Source : | Last Update : Mon, 13 Apr 20