Skip to content
Related Articles

Related Articles

How to write comments in PHP ?
  • Last Updated : 05 Jan, 2021

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

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:

Hello GeeksforGeeks

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

PHP

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:

Hello Geeks

Supported Browsers are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Safari
  • Opera
My Personal Notes arrow_drop_up
Recommended Articles
Page :