Does it matter whether an uppercase or lower case a
is used for php arrays?
For example: array()
vs. Array()
Yep, array keys are case sensitive.
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 [].
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.
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 love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With