title: PHP Search multidimensional associative array by key and return key => value
body: <p>Hi i have a multidimensional associative array: </p>
  
  <pre><code>   $array= array(
              'Book1' =&gt; array('http://www.google.com', '45' ),
              'Book2' =&gt; array('http://www.yahoo.com', '46', )
  )
  </code></pre>
  
  <p>I need to be able to search $array on 'BookX' and then return the contents of 'BookX'. </p>
  
  <p>Ive tried:</p>
  
  <pre><code>  function array_searcher($needles, $array) 
      { 
     foreach ($needles as $needle) {
  
      foreach ($array as $key ) 
          { 
  
              if ($key == $needle) 
                  { 
                  echo $key; 
                  } 
  
          }
          }
    } 
  </code></pre>
  
  <p>with the search </p>
  
  <pre><code>$needles  = array('Book1' , 'Book2' ); 
  </code></pre>
  
  <p>But this doesnt return anything</p>