Following is the array structure that i have used
$arr = Array (
[0] => Array
(
[Research] => '#00c0ef' ,
[class_name] => box-info
)
[1] => Array
(
[Review] => '#00a65a' ,
[class_name] => box-success
)
[2] => Array
(
[Case Study] => '#3c8dbc',
[class_name] => box-primary
)
);
I want to get the key of '#3c8dbc', which means i get the output as Case Study.
Is the following code is a better solution for this ?
$search_value = '#3c8dbc';
$selected_array = array_filter(array_map(function ($ar) use
($search_value) {return array_search($search_value,$ar);}, $userdb));
$selected_item = reset($selected_array);
The $selected_item will print the key of value '#3c8dbc' .
**Output : Case Study**