How to write comments in PHP?

How to write comments in PHP?

Asked on November 1, 2018 in PHP.
Add Comment


  • 1 Answer(s)

        Here the Syntax “// text” and “/* text */” are used.
    Comments are written within the block of PHP code to explain the functionality of the code.

    Comments help to understand what you were trying to do with the PHP code for the user.

    Comments will not be displayed in the output.

    This is Single Line Comments
    PHP single line comment begins with //.

    For example:

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

    This is Multi-line Comments
    PHP multi-line line comment begins with /*, and ends with */.

    For example:

    <?php
        /* The following line of code
            will output the "Hello World!" message */
        echo "Hello World!";
    ?>
    
    Answered on November 1, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.