PHP naming case sensitivity problem

1. Variable names are case sensitive

1 <?php

2 $abc = 'abcd';

3 echo $abc; // output 'abcd'

4 echo $aBc; //no output

5 echo $ABC; //no output

2. The constant name is case-sensitive by default, and is usually written in uppercase
(but I did not find a configuration item that can change this default, solve it)

1 <?php

2 define("ABC","Hello World");

3 echo ABC; //output Hello World

4 echo abc; //output abc

3. The php.ini configuration item directive is case-sensitive,
such as file_uploads = 1 and 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 the definition

1 <?php

2 function show(){

3 echo "Hello World";

4 }

5 show(); //Output Hello World recommended writing

6 SHOW(); //Output Hello World

1 <?php

2 class cls{

3 static function func(){

4 echo "hello world";

5 }

6 }

7

8 Cls::FunC(); //Output hello world

4. Magic constants are not case-sensitive. Recommended uppercase
includes: __LINE__, __FILE__, __DIR__, __FUNCTION__, __CLASS__, __METHOD__, __NAMESPACE__.


1 <?php

2 echo __line__; //output 2

3 echo __LINE__; //output 3

5. NULL, TRUE, FALSE are not case sensitive

01 <?php

02 $a = null;

03 $b = NULL;

04

05 $c = true;

06 $d = TRUE;

07

08 $ e = false;

09 $f = FALSE;

10

11 var_dump($a == $b); //output boolean true

12 var_dump($c == $d); //output boolean true

13 var_dump($e == $f); //output boolean true 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324480004&siteId=291194637