Home  >  Article  >  Backend Development  >  The difference between the short tag and the long tag in PHP

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

怪我咯
怪我咯Original
2017-06-16 15:39:181987browse

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?>
<?=(表达式)?>

which is equivalent to

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

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

<?if(...?>

, it will become

<!--if(...-->


, 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!

Statement:
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