Don't you need to write the ending symbol in php?

藏色散人
Release: 2023-03-17 11:30:02
Original
2134 people have browsed it

php does not need to write the ending symbol, because it is mentioned in the zend php specification that if there is only php code in a file, the ending symbol "?>" is not allowed to appear, which is not necessary in php programming , this can avoid accidentally outputting characters such as spaces.

Don't you need to write the ending symbol in php?

The operating environment of this tutorial: Windows 7 system, PHP version 8.1, Dell G3 computer.

php Don’t you need the ending symbol?

First of all, if PHP and HTML are mixed, the PHP code must be written between by default.

For example:

;

Secondly, if a PHP file is all PHP code, it does not need to Write the closing symbol, just write the beginning.

Zend's coding specification also mentions this. The general idea is: files containing only PHP code are not allowed to have ?> end symbols to prevent unexpected ending output (such as spaces, newlines ), causing the program to respond unexpectedly.

Generally, this kind of accident occurs when files are included.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of Don't you need to write the ending symbol in php?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template