Destramic Posted April 22, 2011 Share Posted April 22, 2011 hey guys i have a an array and i want to know if i can call the value without having to put the array key in capitals. here is my array Array ( [DEVELOPEMENT_ENVIORMENT] => 1 [MSQL_HOST] => localhost [MYSQL_USERNAME] => root [MYSQL_PASSWORD] => test [MYSQL_DABASE_NAME] => test ) can i call the array like $array['mysql_host']Array ( [DEVELOPEMENT_ENVIORMENT] => 1 [MSQL_HOST] => localhost [MYSQL_USERNAME] => root [MYSQL_PASSWORD] => n0real1ty [MYSQL_DABASE_NAME] => test ) can i call the array like $array['mysql_host'] instead of $array['MYSQL_HOST'] whichout renaming the array key if anyone could help please...thank you Quote Link to comment https://forums.phpfreaks.com/topic/234429-array-key/ Share on other sites More sharing options...
fugix Posted April 22, 2011 Share Posted April 22, 2011 unfortunately...array keys are case sensitive..so in order to call a certain key you will need to type it exactly as it appears in the array Quote Link to comment https://forums.phpfreaks.com/topic/234429-array-key/#findComment-1204877 Share on other sites More sharing options...
wildteen88 Posted April 22, 2011 Share Posted April 22, 2011 You can use array_change_key_case to convert the keys to lowercase. Quote Link to comment https://forums.phpfreaks.com/topic/234429-array-key/#findComment-1204930 Share on other sites More sharing options...
Destramic Posted April 24, 2011 Author Share Posted April 24, 2011 awseome thanks guys Quote Link to comment https://forums.phpfreaks.com/topic/234429-array-key/#findComment-1205529 Share on other sites More sharing options...
fugix Posted April 24, 2011 Share Posted April 24, 2011 no problem...let us know if you need further assistance Quote Link to comment https://forums.phpfreaks.com/topic/234429-array-key/#findComment-1205547 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.