Home >Backend Development >PHP Problem >Are variables in php case insensitive?

Are variables in php case insensitive?

青灯夜游
青灯夜游Original
2022-01-04 17:43:193834browse

php variables are case sensitive. In php, all variables are case-sensitive, including user-defined ordinary variables and predefined variables such as $_GET, $_POST, $_REQUEST, $_COOKIE, $_SESSION, $GLOBALS, $_SERVER, $_FILES, etc.

Are variables in php case insensitive?

The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

1. Case sensitive

1. Variable names are case-sensitive

All variables are case-sensitive, including ordinary variables and $_GET, $_POST, $_REQUEST, $_COOKIE, $_SESSION, $GLOBALS, $ _SERVER, $_FILES, $_ENV and other predefined variables;

Predefined variables are also called super global variables. They can be used in all functions without being declared in advance. used in the domain. Through these predefined variables, you can obtain information such as user session, user operating system environment and local operating system environment.

Note: Predefined variables basically exist in the form of arrays.

2. Constant names are case-sensitive by default and are usually written in uppercase letters

##3. php .ini configuration item instructions are case sensitive

For example,

file_uploads = 1 cannot be written as File_uploads = 1

2. Case insensitivity

1. Function names, method names, and class names are not case-sensitive, but it is recommended to use the same name as when defined

Are variables in php case insensitive?

2. Magic constants are not case-sensitive. It is recommended to use uppercase letters

including: __LINE__, __FILE__, __DIR__, __FUNCTION__, __CLASS__, __METHOD__, __NAMESPACE__.

3. NULL, TRUE and FALSE are not case-sensitive

Are variables in php case insensitive?

4. Type coercion is not size-sensitive Write

including

    (int), (integer) – converted to integer type
  • (bool), (boolean) – converted to Boolean type
  • (float), (double), (real) – Convert to floating point type
  • (string) – Convert to string
  • (array) – Convert to array
  • (object) – Convert to object
Recommended learning: "

PHP Video Tutorial"

The above is the detailed content of Are variables in php case insensitive?. 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