Question: I have this array:

```
$a = array('it' => 'italiano',
                 'fr' => 'francese',
                 'en' => 'inglese',
                 'es' => 'spagnolo',
                 'de' => 'deutsch',

               );

```

Is there any function that i give as arguments the array and a key (for example 'en') and it returns 'inglese'?

Regards

Javi

Answer: 
```
$languageName = 'Default';
$languageCode = 'en';
if (isset($a[$languageCode])) {
   $languageName = $a[$languageCode];
}

```
There are a couple of ways you can do this

```
$a = array(
      'it' => 'italiano',
      'fr' => 'francese',
      'en' => 'inglese',
      'es' => 'spagnolo',
      'de' => 'deutsch',
     );

$lang = 'it';
echo getValueFromKey($a,$lang);

function getValueFromKey($array,$key) {
   return $array[$key];
}

```

or like this

```
echo $a['it'];

```