PHP Syntax

On this blog page, you will learn the basic PHP Syntax, Comments in PHP.



PHP Syntax With Example

However, if a file contains only PHP code, the enclosing tag is optional

 

PHP Syntax with Code

 



PHP Comments with Example

PHP supports two types of comments:

  1. One-line comments
  2. Multi-line comments

One-line Comments

A one-line comment starts with the pound (#) or double forward-slash (//) In PHP. The one-line comment is placed at the starting of the line or at the current block.

Example:

 



Multi-line Comments

A Multi-line comment starts with /* and end with */ in PHP.

Example:

 

What is the importance of Comments in PHP.



In PHP Comments are important parts of the code because they explain the purpose of the code or what is the logic written in this code or what the code does. So it makes a programmer more readable.