+ 1

Why the semicolon could be left for one single statement or for the last one?

Semicolon for a single statement or for the last one.

23rd Aug 2016, 2:23 PM
Moez Hammami
3 Réponses
+ 1
The statement will be executed, since code was opened with <?PHP and closed with ? > which is syntaxly correct, and no statement is following the last one.
23rd Aug 2016, 2:30 PM
Moez Hammami
+ 1
A ; is used to separate two consecutive statements. Now if there is only one statement then there is no one to make it separate from. But it is a good practice to use ; though.
24th Aug 2016, 5:29 AM
Apon Shahriar
Apon Shahriar - avatar
+ 1
according to the php manual the closing tag of a block of PHP code automatically implies a semicolon. This happens when in the last statement when there is no other statement following
24th Aug 2016, 8:59 AM
Sandi Sibulali
Sandi Sibulali - avatar