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.;
<?php $abc = 'abc'; echo $abc; //输出'abc' echo $aBc; //无输出 echo $ABC; //无输出 ?>
2. Constant names are case-sensitive
Use define to define Constants are case-sensitive.
<?php define('BLOGGER','Veitor'); echo BLOGGER; //输出'Veitor' echo BLOgger; //报NOTICE提示,并输出'BLOgger' echo blogger; //报NOTICE提示,并输出'blogger' ?>
3. Array index (key name) is case-sensitive
<?php $arr = array('one'=>'first'); echo $arr['one']; //输出'first' echo $arr['One']; //无输出并报错 echo $Arr['one']; //上面讲过,变量名区分大小写,所以无输出并报错 ?>
Recommended tutorial: PHP video tutorial
The above is the detailed content of Are php variable names case sensitive?. For more information, please follow other related articles on the PHP Chinese website!