PHP Comments

Comments are used by programmers while programming irrespective of the programming language. They make the computer program more understandable to the reader and are not interpreted or compiled while execution. PHP contains multiple ways of commenting.

  1. Single-line Commenting : Syntax of single-line commenting is :
<?php
	// Single-line Commenting
	# This is also single-line Commenting
?>
  1. Multiple-line Commenting : Syntax of multiple-line commenting is :
<?php
	
/*
	  
This way of commenting
is
	  used to comment
multiple lines
	  of code.
	
*/

?>

EXAMPLE 1 :  ‘HELLO WORLD’ PHP SCRIPT EMBEDDED WITH HTML

<html>
	<head>
		<title>Hello World</title>
	</head>
	<body>
	<?php
		echo “Hello World !”;	// This will print Hello World on browser screen
	?>
	</body>

</html>

Save this file with .php extension in web directory and run it in browser. Note* : The PHP code written in the above program is processed by the server and plain HTML produced as output is sent to the browser for display.