The following are case-insensitive in PHP: 1. Function name; 2. Method name; 3. Class name; 4. NULL; 5. TRUE; 6. FALSE; 7. Keywords; 8. Magic constants are also not case-sensitive, but uppercase is recommended.
The operating environment of this tutorial: windows10 system, PHP7.1 version, DELL G3 computer
1. Variable names are case-sensitive
<?php $abc = 'abcd'; echo $abc; //输出 'abcd' echo $aBc; //无输出 echo $ABC; //无输出
2. 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
For example, file_uploads = 1 cannot be written as File_uploads = 1
3. 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"; } show(); //输出 Hello World 推荐写法 SHOW(); //输出 Hello World<?php class cls{ static function func(){ echo "hello world"; } } Cls::FunC(); //输出hello world
4. 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
5, NULL, TRUE, FALSE are not case-sensitive
<?php $a = null; $b = NULL; $c = true; $d = TRUE; $e = false; $f = FALSE; var_dump($a == $b); //输出 boolean true var_dump($c == $d); //输出 boolean true var_dump($e == $f); //输出 boolean true
Summary:
In PHP, function names (custom and built-in functions), method names, class names, and keywords are not case-sensitive; but variable names are case-sensitive.
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of What is case insensitive in php. For more information, please follow other related articles on the PHP Chinese website!