Tuesday, April 16, 2024

Learn PHP Comments Step by Step

 Comments in PHP Program



php Comments

  1]Comments in PHP code are lines that are not executed as part of the program.

  2] Its sole purpose is to read the tracker's code. 

  3]all experienced returning to work after a year or two and wondering what to do next.

  4] Comments can remind you what you were thinking when you wrote the number
     Leave
 spaces between numbers

PHP echo post

Types of PHP Comments

  • Single-line comments (// or #)
  • Multi-line comments (/* ... */)

Advantages

  • Easier debugging
  • Better collaboration
  • Improved readability
  • Professional coding practice

Learn PHP Operators Step by step 

Comments in PHP Example :-

<!doctype html>
<html>
    <head>
        <title>html code and php code</title>
    </head>
<body>
    <h1>MY FIRST PROGRAM IN PHP </h1>
    <?php
    //echo "Hello friends
    // How are your
   
    //fine "
         ?>
</body>
</html>


Comments in PHPOutput :-

MY FIRST PROGRAM IN PHP

Interview Questions with Answers

1]  What is a PHP comment?
      non-executable note inside code.

2]  Difference between single-line and multi-line comments? 
      → Single-line uses // or #, multi-line uses /* ... */.

3]  Why are comments important?
     → They improve readability and collaboration.

. FAQ

1] Can comments affect performance? 
No, they are ignored by PHP.

2] Are comments necessary in small scripts?
Yes, for clarity.

3] Can comments be nested? 
No, multi-line comments cannot be nested.

No comments:

Post a Comment