What are the contents of the php start tag?

DDD
Release: 2023-08-02 14:22:46
Original
1150 people have browsed it

The operating environment of this article: Windows 10 system, PHP8.1.3 version, Dell G3 computer.

The PHP start tag is a special syntax structure used to indicate the beginning of PHP code. It tells the parser that the following code should be interpreted as PHP code, not ordinary HTML or other types of code. There are several different forms of PHP start tags, and the contents of each form are described in detail below.

Short tag form (

The short tag form is the most common and simplest form of PHP start tag. It consists of a less than sign (<) and a question mark (?), which can be followed by a space or newline character. Its syntax is as follows:

In the short tag form, the PHP code must be in between. This form of opening tag is enabled by default in all versions of PHP, but may be disabled in some cases.

Short tag form (

The short tag form can also be used to output the value of a variable or expression. It consists of a less than sign (<), a question mark (?) and an equal sign (=). Its syntax is as follows:

In this example, $variable is a variable that contains the content to be output. This form of opening tag is enabled by default in all versions of PHP, but may be disabled in some cases.

Full tag form (

The full tag form is a longer start tag form, consisting of a less than sign (<), a It consists of a question mark (?) and the letter p (p), which can be followed by a space or a newline character. Its syntax is as follows:

The full tag form of the opening tag is enabled by default in all versions of PHP and is not affected by disabling it.

Short tag form (<%)

The short tag form can also use tags similar to ASP. It consists of a less than sign (<) and a percent sign (%). This form of opening tag was introduced in PHP version 5.4.0 and is enabled by default. However, it was removed in PHP version 7.0.0 and is therefore deprecated.

It should be noted that in order to ensure the portability and compatibility of the code, it is recommended to always use the full tag form (

Summary

There are many forms of PHP start tags, including short tag forms (

The above is the detailed content of What are the contents of the php start tag?. 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