title: PHP multidimensional array search by value
body: <p>I have an array where I want to search the <code>uid</code> and get the key of the array.</p>
  
  <h2>Examples</h2>
  
  <p>Assume we have the following 2-dimensional array:</p>
  
  <pre><code>$userdb = array(
      array(
          'uid' =&gt; '100',
          'name' =&gt; 'Sandra Shush',
          'pic_square' =&gt; 'urlof100'
      ),
      array(
          'uid' =&gt; '5465',
          'name' =&gt; 'Stefanie Mcmohn',
          'pic_square' =&gt; 'urlof100'
      ),
      array(
          'uid' =&gt; '40489',
          'name' =&gt; 'Michael',
          'pic_square' =&gt; 'urlof40489'
      )
  );
  </code></pre>
  
  <p>The function call <code>search_by_uid(100)</code> (uid of first user) should return <code>0</code>.</p>
  
  <p>The function call <code>search_by_uid(40489)</code> should return <code>2</code>.</p>
  
  <p>I tried making loops, but I want a faster executing code.</p>