PHP instruction separation

The PHP instruction separation is semicolon(;).
As in any another programming language, every instructions to be terminated with a semicolon(;).
Same in PHP also requires instructions to be end with semicolon at the end of each statement.
The closing tag of a block of PHP code automatically implies a semicolon(;).
You do not need to have a semicolon terminating the last line of a PHP block.

For example:

Output:

It is not necessary to give semicolon after a echo statement if your script contain only one instruction.
For example:

Ankit Wasankar

Senior Java Developer
Java 11 | Microservices | Reactjs | SQL

Help others by sharing the content!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.