PHP Comments

PHP Comments

In PHP, comments are used to explain the code or to make it more understandable to other developers. They can also be used to temporarily disable a piece of code without having to delete it. PHP supports two types of comments:

  1. Single-line comments: They begin with two forward slashes “//” and end at the end of the line. For example:

// This is a single-line comment in PHP

  • Multi-line comments: They begin with “/” and end with “/”. They can span multiple lines. For example:

/* This is a multi-line comment in PHP that can span multiple lines */ It’s good practice to include comments in your code to make it more readable and maintainable. However, you should avoid over-commenting, as it can make the code harder to read.

Apply for PHP Certification!

https://www.vskills.in/certification/certified-php-developer

Back to Tutorials

Generating a Data-Driven Web Page
Using the database to build a Web page

Get industry recognized certification – Contact us

keyboard_arrow_up
Open chat
Need help?
Hello 👋
Can we help you?