开发者

php array - upper case or lower case

Does it matter whether an uppercase or lower case 开发者_开发问答a is used for php arrays?

For example: array() vs. Array()


I believe the OP is referring to this:

<?php
$arr = array("foo" => "bar", 12 => true);
var_dump($arr);
// returns array(2) { ["foo"]=>  string(3) "bar" [12]=>  bool(true) }

$arr = Array("foo" => "bar", 12 => true);
var_dump($arr);
// also returns array(2) { ["foo"]=>  string(3) "bar" [12]=>  bool(true) }
?>

So the answer is no, there is no difference


If you mean:

$array = Array(1,2,3);

vs

$array = array(1,2,3);

vs

$array = aRRaY(1,2,3);

there is no functional difference. It is only a question of style. Like PHP functions, the array language construct is case-insensitive.


If you mean array names/variables, then yes it does, PHP variables are case-sensitive. If however, you are asking about standards, have a look at:

PHP Coding Standard about Naming Conventions


David - yes it does. they are treated as different variables $varPerson and $varperson.

However, the main thing really is more that you should be following some kind of coding guideline doc that mandates case and scope of all variables. this is probably a much more important driver of variable naming/case than the simple question implies.

jim

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜