Find array value using key

JEagle picture JEagle · Jun 4, 2010 · Viewed 149.3k times · Source

I would like to find the value in an array using the key.

like this:

$array=('us'=>'United', 'ca'=>'canada');
$key='ca';

How can i have the value 'canada'? thanks.

Answer

HoLyVieR picture HoLyVieR · Jun 4, 2010

It's as simple as this :

$array[$key];