Thursday, September 4, 2025
HomeLanguagesHow to write comments in PHP ?

How to write comments in PHP ?

In this article, we have to pass a comment for PHP code by using some simple basic syntax. Comments are helpful to understand the complex code. The comment tag is useful during the debugging of the codes. We use comments to understand the functionality of the code. 

Basically, the single-line comments begin with // comments.   

Example 1:  

PHP




<?php
  
// Output "Hello neveropen"
echo "Hello neveropen";
  
?>


Output:

Hello neveropen

Example 2: Multiline comments begin with /* and ends with */.

PHP




<?php
  
echo "Hello Geeks"
/* It will print the 
   message   "Hello neveropen" */
  
?>


Output:

Hello Geeks

Supported Browsers are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Safari
  • Opera
RELATED ARTICLES

Most Popular

Dominic
32264 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6632 POSTS0 COMMENTS
Nicole Veronica
11800 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11860 POSTS0 COMMENTS
Shaida Kate Naidoo
6749 POSTS0 COMMENTS
Ted Musemwa
7025 POSTS0 COMMENTS
Thapelo Manthata
6698 POSTS0 COMMENTS
Umr Jansen
6718 POSTS0 COMMENTS