In the process of developing PHP, because naming case issues can easily lead to code errors, we have compiled some information on PHP case sensitivity from the Internet. Friends who need it can refer to it.
PHP’s handling of case-sensitive issues is messy, and problems may occasionally occur when writing code, so I’ll summarize it here. But I'm not encouraging everyone to use these rules. It is recommended that everyone always adhere to "case sensitivity" and follow unified coding standards.
1. Variable names are case-sensitive
Copy after login
2. Constant names are case-sensitive by default and are usually written in uppercase
Constants defined using define are case-sensitive.
3. Function names, method names, and class names are not case-sensitive
But it is recommended to use the same name as when defined
Copy after login
show (); //Output Hello World. Recommended writing method
SHOW(); //Output Hello World
Copy after login
4. Magic constants are not case-sensitive. Capital letters are recommended
Includes: __LINE__, __FILE__, __DIR__, __FUNCTION__, __CLASS__, __METHOD__, __NAMESPACE__.
Copy after login
5. NULL, TRUE and FALSE are not case-sensitive
Copy after login
5. Array index (key name) is case-sensitive
'first'); echo $arr['one']; //输出'first' echo $arr['One']; //无输出并报错 echo $Arr['one']; //上面讲过,变量名区分大小写,所以无输出并报错 ?>
Summary:
In PHP, function names, method names, class names, and keywords are not case-sensitive; but variables Names and constant names are case-sensitive.
The above is the detailed content of Is php case sensitive?. For more information, please follow other related articles on the PHP Chinese website!