I need to find the value for a key by searching for another value within the same array of a multidimensional array.
This is the given array:
<?php
$users = array(
"userA" => array(
"email" => "[email protected]",
"language" => "en",
),
"userB" => array(
"email" => "[email protected]",
"language" => "de",
),
"userC" => array(
"email" => "[email protected]",
"language" => "it",
),
);
?>
Example: I want to input...
$lang = 'de';
...and get the value for "email" of that same item. So in this case it should output:
[email protected]
The languages are unique, so there will only be one possible match.
If this already might be asked, I apologize, but I couldn't find anything with that structure and this search condition.
Thanks in advance.