title: PHP Multidimensional Array Searching (Find key by specific value)
body: <p>I have this multidimensional array. I need to search it and return only the key that matches the value of the "slug". I know there are other threads about searching multidimensional arrays, but I'm not really understanding enough to apply to my situation. Thanks very much for any help!</p>
  
  <p>So I need a function like:</p>
  
  <pre><code>myfunction($products,'breville-one-touch-tea-maker-BTM800XL');
  // returns 1
  </code></pre>
  
  <p>Here's the Array:</p>
  
  <pre><code>$products = array (
  1  =&gt; array(
          'name'          =&gt; 'The Breville One-Touch Tea Maker',
          'slug'          =&gt; 'breville-one-touch-tea-maker-BTM800XL',
          'shortname'     =&gt; 'The One-Touch Tea Maker',
          'listprice'     =&gt; '299.99',
          'price'         =&gt; '249.99',
          'rating'        =&gt; '9.5',
          'reviews'       =&gt; '81',
          'buyurl'        =&gt; 'http://www.amazon.com/The-Breville-One-Touch-Tea-Maker/dp/B003LNOPSG',
          'videoref1'     =&gt; 'xNb-FOTJY1c',
          'videoref2'     =&gt; 'WAyk-O2B6F8',
          'image'         =&gt; '812BpgHhjBML.jpg',
          'related1'      =&gt; '2',
          'related2'      =&gt; '3',
          'related3'      =&gt; '4',
          'bestbuy'       =&gt; '1',
          'quote'         =&gt; '',
          'quoteautor'    =&gt; 'K. Martino',
          ),
  
  2  =&gt; array(
          'name'          =&gt; 'Breville Variable-Temperature Kettle BKE820XL',
          'slug'          =&gt; 'breville-variable-temperature-kettle-BKE820XL',
          'shortname'     =&gt; 'Variable Temperature Kettle',
          'listprice'     =&gt; '199.99',
          'price'         =&gt; '129.99',
          'rating'        =&gt; '9',
          'reviews'       =&gt; '78',
          'buyurl'        =&gt; 'http://www.amazon.com/Breville-BKE820XL-Variable-Temperature-1-8-Liter-Kettle/dp/B001DYERBK',
          'videoref1'     =&gt; 'oyZWBD83xeE',
          'image'         =&gt; '41y2B8jSKmwL.jpg',
          'related1'      =&gt; '3',
          'related2'      =&gt; '4',
          'related3'      =&gt; '5',
          'bestbuy'       =&gt; '1',
          'quote'         =&gt; '',
          'quoteautor'    =&gt; '',
          ),
  );
  </code></pre>