Php case sensitivity issues. PHP handles case-sensitive issues in disorder and may occasionally encounter issues when writing code. So here is a summary. However, I do not encourage you to use these rules. We recommend that you always stick to the principle that "PHP is not case sensitive and may occasionally encounter problems when writing code, so let's summarize it here.
However, I do not encourage you to use these rules. We recommend that you always adhere to the "case sensitivity" and follow the unified code specifications.
I. case sensitivity
1. variable names are case sensitive
All variables are case sensitive, including common variables and $ _ GET, $ _ POST, $ _ REQUEST, $ _ COOKIE, $ _ SESSION, $ GLOBALS, $ _ SERVER, $ _ FILES, $ _ ENV, etc;
The code is as follows:
$ Abc = 'abc ';
Echo $ abc; // output 'ABC'
Echo $ aBc; // no output
Echo $ ABC; // no output
2. constant names are case-sensitive by default and are generally written in uppercase.
(But the default configuration item cannot be changed)
The code is as follows:
1 Define ("ABC", "Hello World ");
Echo ABC; // output Hello World
Echo abc; // output abc
3. the php. ini configuration item command is case sensitive.
For example, file_uploads = 1 cannot be written as File_uploads = 1
II. case insensitive
4. the function name, method name, and class name are case-insensitive, but the same name as the class name is recommended.
The code is as follows:
Function show (){
Echo "Hello World ";
}
Show (); // output the recommended Hello World statement
SHOW (); // output Hello World
The code is as follows:
Class cls {
Static function func (){
Echo "hello world ";
}
}
Cls: FunC (); // output hello world
5. the magic constants are case-insensitive. uppercase is recommended.
Including: __line _, _ FILE _, _ DIR _, _ FUNCTION _, _ CLASS _, _ METHOD _, and _ NAMESPACE __.
The code is as follows:
Echo _ line __; // output 2
Echo _ LINE __; // output 3
6. NULL, TRUE, and FALSE are case insensitive.
The code is as follows:
$ A = null;
$ B = NULL;
$ C = true;
$ D = TRUE;
$ E = false;
$ F = FALSE;
Var_dump ($ a = $ B); // outputs boolean true
Var_dump ($ c ==$ d); // outputs boolean true
Var_dump ($ e = $ f); // outputs boolean true
7. type forced conversion, case insensitive, including:
* (Int), (integer)-convert to integer
* (Bool), (boolean)-convert to boolean
* (Float), (double), (real)-convert to floating point type
* (String)-convert to string
* (Array)-convert to an array
* (Object)-convert to object
The code is as follows:
$ A = 1;
Var_dump ($ a); // output int 1
$ B = (STRING) $;
Var_dump ($ B); // output string '1' (length = 1)
$ C = (string) $;
Var_dump ($ c); // output string '1' (length = 1)
Bytes. However, I do not encourage you to use these rules. We recommend that you always stick to "...