php comment code code example
Example 1: comment in php
<?php
/*
echo 'This is a test'; /* This comment will cause a problem */
*/
?>
Example 2: php comment
<?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;
?>
Example 3: comments in php
//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)-->*/
Example 4: how to create comments in php
Answer: Use the Syntax "// text" (single line) and "/* text */"
(multi-line)