Разделение инструкций
Инструкции разделяются также как и в C или Perl - каждое выражение заканчивается точкой с запятой.
Закрывающий тег (?>) также подразумевает конец инструкции, поэтому два следующих фрагмента кода эквиваленты:
<?php
echo "Это тест";
?>
<?php echo "Это тест" ?>
Коментарии
Do not mis interpret
<?php echo 'Ending tag excluded';
with
<?php echo 'Ending tag excluded';
<p>But html is still visible</p>
The second one would give error. Exclude ?> if you no more html to write after the code.
You are also able to write more than one statement in one line, just separating with a semicolon, example:
<?php
echo "a"; echo "b"; echo "c";
#The output will be "abc" with no errors
?>
A user from stack overflow had a nice explanation for the trailing newline, simply put,
<?= "Hello" ?>
Jello
would output,
HelloJello
meaning that implicit newline from the ?> tag is not there, however one can simply add that to the code such as,
<?= "Hello" ?>
Jello
the space between acts as a new line after the closing tag