To use this website fully, you first need to accept the use of cookies. By agreeing to the use of cookies you consent to the use of functional cookies. For more information read this page.

Part 2.2Comments in PHP

Comments in PHP

As with most programming languages (or maybe all programming languages), PHP supports comments.

PHP follows the traditional C style comments but it also adds a couple of non-C style ones too. There are a total of three different ways a comment can be opened in PHP:

  • #
  • //
  • /* */
PHP
<?php
	# Put our code here
	// Put our code here

	/*
	* This comment is
	* multiline
	*/
?>
					

The # and // comments are interchangeable whereas the /* and */ combination is the multiline comment.

Code previewClose
Feedback 👍
Comments are sent via email to me.