-
- $abc = 'abcd';
- echo $abc; //Output 'abcd'
- echo $aBc; //No output
- echo $ABC; //No output
- ?>
Copy code
2. Constant names are case-sensitive by default and are usually written in uppercase
(But I couldn’t find a configuration item that can change this default, please solve it)
example:
-
- define("ABC","Hello World");
- echo ABC; //Output Hello World
- echo abc; //Output abc
- ?>
Copy code
3. php.ini configuration item instructions are case sensitive
For example, file_uploads = 1 cannot be written as File_uploads = 1
2. Case insensitive
1. Function names, method names, and class names are not case-sensitive, but it is recommended to use the same names as when they were defined.
example:
-
- function show(){
- echo "Hello World";
- }
- show(); //Output Hello World Recommended writing method
- SHOW(); //Output Hello World
- ?> ;
Copy code Example:
class cls{ - static function func(){
- echo "hello world";
- }
- }
Cls:: FunC(); //Output hello world
- ?>
-
Copy code
2. Magic constants are not case-sensitive, uppercase is recommended
Includes: __LINE__, __FILE__, __DIR__, __FUNCTION__, __CLASS__, __METHOD__, __NAMESPACE__.
example:
-
- echo __line__; //Output 2
- echo __LINE__; //Output 3
- ?>
Copy code
3. NULL, TRUE, FALSE are not case sensitive
example:
-
- $a = null;
- $b = NULL;
- $c = true;
- $d = TRUE;
- $e = false;
- $f = FALSE;
- var_dump($ a == $b); //Output boolean true
- var_dump($c == $d); //Output boolean true
- var_dump($e == $f); //Output boolean true
- ?>
Copy code
4. Type coercion, case-insensitive
include
-
- $a=1;
- var_dump($a); //Output int 1
- $b=(STRING)$a;
- var_dump($b); //Output string ' 1' (length=1)
- $c=(string)$a;
- var_dump($c); //Output string '1' (length=1)
- ?>
Copy code
|