$myArray = array (\'SOmeKeyNAme\' => 7);
I want $myArray[\'somekeyname\']
to return 7
.
Is there a way to do this
I know this is an older question but the most elegant way to handle this problem is to use:
array_change_key_case($myArray); //second parameter is CASE_LOWER by default
In your example:
$myArray = array ('SOmeKeyNAme' => 7);
$myArray = array_change_key_case($myArray);
Afterwards $myArray will contain all lowercase keys:
echo $myArray['somekeyname'] will contain 7
Alternatively you can use:
array_change_key_case($myArray, CASE_UPPER);
Documentation be seen here: http://us3.php.net/manual/en/function.array-change-key-case.php