how to comment in php code example

Example 1: php comment

// 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
*/

Example 2: comment in php

<?php
 /*
    echo 'This is a test'; /* This comment will cause a problem */
 */
?>

Example 3: comment in php

<?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;
?>

Example 4: php proper function comments

/**
 * 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
 */

Example 5: 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 6: how to make a comment in php

// single line comment
/* multi line comment
hello
*/

Tags:

Html Example