Q:

How to write comments in PHP

0

How to write comments in PHP

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Use the Syntax "// text" and "/* text */"

Comments are usually written within the block of PHP code to explain the functionality of the code. It will help you and others in the future to understand what you were trying to do with the PHP code. Comments are not displayed in the output, they are ignored by the PHP engine.

Single Line Comments

PHP single line comment begins with //, See the example below:

<?php
    echo "Hello World!"; // Output "Hello World!"
?>

Multi-line Comments

PHP multi-line line comment begins with /*, and ends with */.

<?php
    /* The following line of code
       will output the "Hello World!" message */
    echo "Hello World!";
?>

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

PHP  and MySQL Frequently Asked Questions

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
How to remove white space from a string in PHP... >>