Home >Backend Development >PHP Tutorial >26 letter case php case sensitivity issues sorted out
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.
1. Case sensitive
1. Variable names are case sensitive
All variables are case sensitive, including ordinary variables and $_GET, $_POST, $_REQUEST, $_COOKIE, $_SESSION, $GLOBALS, $_SERVER, $_FILES , $_ENV, etc.;
Copy the code The code is as follows:
$abc = 'abcd';
echo $abc; //Output 'abcd'
echo $aBc; //None Output
echo $ABC; //No output
Copy code The code is as follows:
1 define("ABC","Hello World");
echo ABC; //Output Hello World
echo abc; //Output abc
Copy the code The code is as follows:
function show(){
echo "Hello World";
}
show(); //Output Hello World Recommended writing method
SHOW(); //Output Hello World
Copy code The code is as follows:
class cls{
static function func(){
echo "hello world";
}
}
Cls::FunC( ); //Output hello world
Copy code The code is as follows:
echo __line__; //Output 2
echo __LINE__; //Output 3
Copy code The code is as follows:
$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 Code As follows:
$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)
The above has introduced the arrangement of the case-sensitive issues in PHP for the 26 letters, including the content of the 26 letters. I hope it will be helpful to friends who are interested in PHP tutorials.