Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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()

like image 919
David Avatar asked Jul 13 '10 09:07

David


People also ask

Are PHP array keys case sensitive?

Yep, array keys are case sensitive.

What is difference between array and [] in PHP?

Note: Only the difference in using [] or array() is with the version of PHP you are using. In PHP 5.4 you can also use the short array syntax, which replaces array() with [].

Can you use toUpperCase in an array?

To convert all array elements to uppercase: On each iteration, call the toUpperCase() method to convert the string to uppercase and return the result. The map method will return a new array with all strings converted to uppercase.


1 Answers

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

like image 196
robjmills Avatar answered Sep 18 '22 15:09

robjmills