 <p>There are probably better ways to design that array, but here's a function that should give you what you asked for:</p> <pre><code>function gethours($x, $myoptions){ foreach($myoptions as $o){ if($o[0] == $x){ return $o[1]; } } } echo gethours('3 days', $myoptions); </code></pre> <p>If the column you search in is always the same you could just go for an associative array and use that column as array keys. </p>