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 am not encouraging everyone to use these rules. It is recommended that everyone always adhere to "case sensitivity" and follow unified coding standards.
Variable names are case-sensitive (Recommended learning: PHP programming from entry to proficiency)
<?php $abc = 'abcd'; echo $abc; //输出 'abcd' echo $aBc; //无输出 echo $ABC; //无输出
Constant names are case-sensitive by default and are usually written in uppercase
<?php define("ABC","Hello World"); echo ABC; //输出 Hello World echo abc; //输出 abc
php.ini configuration item instructions are case-sensitive
such as file_uploads = 1 cannot be written as File_uploads = 1
Function names, method names, and class names are not case-sensitive
But it is recommended to use the same name as when defined
<?php function show(){ echo "Hello World"; }
Magic constants are not case-sensitive, uppercase letters are recommended
Including: __LINE__, __FILE__, __DIR__, __FUNCTION__, __CLASS__, __METHOD__, __NAMESPACE__.
<?php echo __line__; //输出 2 echo __LINE__; //输出 3
The above is the detailed content of Are php class names case sensitive?. For more information, please follow other related articles on the PHP Chinese website!