have ever seen more than in PCP files there is no closing tag ? & gt;
& lt;? php //code // Closing tag no
What is it connected with and how to write correctly?
Answer 1, Authority 100%
Duc and PHP Documentation For whom? 😉
If the file contains only PHP code, preferably omit the closing tag at the end of the file. It helps to avoid adding random space characters or a row translation after the closing PHP tag that can cause undesirable effects, since PHP begins to display data into a buffer if there is no intention of the programmer to output any data at this point of the script.
Answer 2, Authority 80%
How to write correctly?
And so it will be right. Closing tags are required for HTML files containing PHP code (although it will be correct to say “PHP files containing HTML code). But if you have a file only with PHP code, then the closing tag is not necessary.
If you go into details, then to output PHP, the server must not just give the browser file “as is” (as in the case of HTML) and call the PHP interpreter. PHP interpreter will read (and execute) code until you encounter the closing tag or until you encounter the end of the file. So you can use and not use closing tags.