Answer the question
In order to leave comments, you need to log in
Case insensitive in associative array?
I am writing a bot for the VKontakte community in php.
But I ran into a problem.
There is an associative array of the form "Question"=>"Answer"
In this array, the Question is written with a capital letter, is it possible to make it possible to write both an array and an ARRAY ???
Don't offer to create a "clone" of an array string with a different case.
PY SY Tried already to do so "Question", "QUESTION", "question" => "Answer", does not work (
You are the last hope
Answer the question
In order to leave comments, you need to log in
Before using an associative array, convert all keys to lower case using the php.net/manual/fr/function.strtolower.php function and that's it.
$key = "Вопрос";
$key = strtolower($key);
echo $arr[$key];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question