+ 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.
3 Answers
+ 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.
+ 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.
+ 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