Home > Article > Backend Development > What are the abbreviations for PHP starter characters?
The abbreviations of the php start character include short tag form () and short output tag form (= $variable ?>). Detailed introduction: 1. Short tag form, use instead of the complete instead of the full .
The operating system for this tutorial: Windows 10 system, PHP8.1.3 version, Dell G3 computer.
In PHP, there are two abbreviations for the start symbol. The following is a detailed introduction to these two abbreviations:
Short Tags: The short tag form is a simplified PHP starting symbol, using instead of the complete of
Short Echo Tags: The short echo tag form is a shorthand form for outputting variable values. Use = $variable ?> instead of full The . The short output markup form was enabled by default before PHP 5.4.0, but is considered deprecated after PHP 5.4.0. This is because on some servers, short output markup forms may be disabled, causing code compatibility issues in different environments.
It is important to note that although short markup forms and short output markup forms were enabled by default in the past, they are considered deprecated in current PHP versions. In order to ensure code portability and compatibility, it is recommended to use the complete
In PHP version 7.4, another short form has been introduced, namely Arrow Functions. Arrow functions use the fn keyword as the starting symbol to define anonymous functions. For example, $sum = fn($a, $b) => $a $b;. Arrow functions provide a cleaner syntax for defining simple anonymous functions, but they are only available in PHP versions 7.4 and above.
To sum up, the abbreviations of the start symbol in PHP include short tag form () and short output tag form (= $variable ?>), but in modern PHP versions, they are Considered deprecated. It is recommended to use the complete
The above is the detailed content of What are the abbreviations for PHP starter characters?. For more information, please follow other related articles on the PHP Chinese website!