Home  >  Article  >  Backend Development  >  Is there any difference in the case of variable names, function names, etc. in PHP? (example)

Is there any difference in the case of variable names, function names, etc. in PHP? (example)

藏色散人
藏色散人Original
2018-08-14 14:26:4511940browse

For those who are new to PHP, they often encounter this problem. Is PHP case-sensitive? Is php case sensitive? Are php functions case sensitive? Are PHP custom functions case sensitive? If they are distinguished, what is the impact of the distinction in case of upper and lower case? So in response to these problems, this article will give you a detailed introduction and summary of relevant knowledge points about PHP capitalization. Hope it helps friends in need.

1. PHP variables are case-sensitive

php variable name size-sensitive code examples are as follows:

Is there any difference in the case of variable names, function names, etc. in PHP? (example)

Is there any difference in the case of variable names, function names, etc. in PHP? (example)

As shown in the above code, we set the value of variable ABC to abc, then PHP outputs the value of ABC as abc. However, if we change the case of the variable, we will find that the result cannot be output. So remember that php variables are case sensitive!

2. Constant names are case-sensitive by default

The code example is as follows:

Is there any difference in the case of variable names, function names, etc. in PHP? (example)

As above code, we define The constant value is Hello World and the output ABC value is Hello World.

Note: php.ini configuration item instructions are case-sensitive. For example, file_uploads = 1 cannot be written as File_uploads = 1

3. Method names, class names, and function names are not case-sensitive. The

is recommended to use the same name as when defined!

Code examples are as follows:

Is there any difference in the case of variable names, function names, etc. in PHP? (example)

4. Magic constants are not case-sensitive

It is recommended to use uppercase! For example:

Is there any difference in the case of variable names, function names, etc. in PHP? (example)

##5. TRUE, FALSE, and NULL are not case-sensitive

The code example is as follows:

Is there any difference in the case of variable names, function names, etc. in PHP? (example)

In PHP, variables are stored in C language structures. Empty strings, NULL, and false are all stored with a value of 0; the type of empty strings is string, NULL. The type is NULL, false is boolean. Usually 0 and 1 equal false and true.

The above is an introduction and summary of issues related to PHP case. It has certain reference value and I hope it will be helpful to friends in need!

【Recommended related articles】

How to convert strings to uppercase and lowercase in php?

Recommended articles about PHP case

How does PHP achieve case conversion?

The above is the detailed content of Is there any difference in the case of variable names, function names, etc. in PHP? (example). 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