For beginners of new PHP, often encounter such a problem, PHP is case-sensitive? is PHP case sensitive? are PHP functions case-sensitive? are PHP custom functions case-sensitive? If so, what is the difference between the case and casing? So in response to these questions, this article will give you a detailed introduction to summarize about the PHP case-related knowledge points. Hope to be helpful to the needy friend.
First, the PHP variable is case-sensitive
The PHP variable name size distinguishes code example as follows:
As the code above, we set the value of the variable ABC to ABC, then the value of the PHP output ABC is ABC, but if we change the case of the variable, we will find that the result is not lost. So remember that PHP variables are case-sensitive!
Second, the constant name is case-sensitive by default
The code examples are as follows:
As above code, we define the constant value for Hello World at this time output ABC value for Hello World.
Note: PHP.ini configuration item directives are case-sensitive as File_uploads = 1 cannot be written as File_uploads = 1
Method name, class name, function name are case-insensitive
It is recommended to use the same name as the definition!
The code examples are as follows:
Iv. Magic constants are case-insensitive
We recommend using Uppercase! Such as:
Five, TRUE, FALSE, null case insensitive
The code examples are as follows:
In PHP, variables are stored in the structure of the C language, empty strings and null,false are stored with a value of 0, and the type of an empty string is the type of string,null that is Null,false is Boolean. Typically 0, 1 equals false, True.
This is a summary of the relevant questions about PHP case. Have a certain reference value, hope to have the help of friends in need!