Home>Article>Backend Development> Which symbol does all php variables start with?

Which symbol does all php variables start with?

王林
王林 Original
2019-09-19 11:54:06 15077browse

Which symbol does all php variables start with?

All variables in PHP start with the $ symbol. The following is an introduction to the naming convention of PHP variables:

1. Variables start with the $ symbol, and the others followed by the name of the variable

2. The variable name must start with a letter or underscore

3. The variable name cannot start with a number

4. Variable names can only contain alphanumeric characters and underscores (A-z, 0-9 and _)

5. Variable name pairs Case sensitive ($y and $Y are two different variables)

For example:

Which symbol does all php variables start with?

Note:php variables have a certain range of use after being declared. Most php variables are not declared in functions. Only a separate range from the declaration to the end of the file is used. This separate range can be used in all php modes on a page. , also includes include and require import files. During the variable usage period, you can use unset() to release the specified variable, use isset() to check whether the variable is set, and use isempty() to check whether the variable is empty.

Recommended tutorial:PHP video tutorial

The above is the detailed content of Which symbol does all php variables start with?. 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
Previous article:How to write php array Next article:How to write php array