PHP多维数组搜索(按特定值查找键)
我有这个多维数组。我需要搜索它,仅返回与“ slug”的值匹配的键。我知道还有其他有关搜索多维数组的线程,但是我对这些情况的理解还不够。非常感谢您的帮助! 所以我需要一个像这样的函数: myfunction($products,'breville-one-touch-tea-maker-BTM800XL'); // returns 1 这是数组: $products = array ( 1 => array( 'name' => 'The Breville One-Touch Tea Maker', 'slug' => 'breville-one-touch-tea-maker-BTM800XL', 'shortname' => 'The One-Touch Tea Maker', 'listprice' => '299.99', 'price' => '249.99', 'rating' => '9.5', 'reviews' => '81', 'buyurl' => 'http://www.amazon.com/The-Breville-One-Touch-Tea-Maker/dp/B003LNOPSG', 'videoref1' => 'xNb-FOTJY1c', 'videoref2' …