There are four ways to write the
php tag, namely: 1. []; 2. []; 3. [<% echo=""> ]; 4. [ 】.
The operating environment of this article: windows10 system, php 5.4&&php 7, thinkpad t480 computer.
I believe everyone knows that the beginning of php program is
Normal writing method
-
echo 1; ?> Short tag writing method, 5.4 Start= 'hello'; === echo 'hello';
- ##<% echo 1; %> asp style writing
- Long tag writing method
The differences between different versions are as follows:The first way is normal writing, there is nothing to say. The second type requires the directive short_open_tag in the php.ini configuration file to be turned on before it is available, or the --enable-short-tags option is added when compiling PHP. As of PHP 5.4, the short form echo tag = is always recognized and valid, regardless of the short_open_tag setting. The third method is not recommended. It is a syntactic sugar writing method added for asp programmers to learn php. It needs to be opened through the directive asp_tags in the php.ini configuration file before it can be used. The fourth type is no longer parsed after php7.0. Recommended learning: php training
The above is the detailed content of What are the ways to write php tags?. For more information, please follow other related articles on the PHP Chinese website!