The difference between the short tag and the long tag in PHP

怪我咯
Release: 2023-03-10 15:30:01
Original
1986 people have browsed it

The so-called identifier refers to the name of the variable.

The names of functions and classes are also identifiers.

PHP rules about identifiers:

  • Identifiers can be letters, numbers, underscores of any length, and must not start with a number.

  • Identifiers in PHP are case-sensitive, but function names are an exception.

  • The variable name can be the same as the function name. But it should be avoided as much as possible.

  • You cannot create a function with the same name as an existing function.

short tags are only used to output variables or expressions. The general usage is

<?=$a?>
<?=(表达式)?>
Copy after login

which is equivalent to

<?php echo $a?>
<?php echo (表达式)?>
Copy after login

does not support Such as if, for and other structures.
If you write

<?if(...?>
Copy after login

, it will become

<!--if(...-->
Copy after login


, so when writing a program, you must use long tags and insert the output into the html Short markers are sometimes used.

The above is the detailed content of The difference between the short tag and the long tag in PHP. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!