Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 2
    While this code may answer the question, providing additional context regarding how and/or why it solves the problem would improve the answer's long-term value. Commented Feb 12, 2017 at 9:09
  • 4
    6 years later, it gave me what I need. array_column() Commented Jan 23, 2018 at 23:27
  • perfect answer for multidimensional array Commented Jul 4, 2018 at 5:24
  • 1
    Lil goodie : we can also search a key of a value with array_column() : $key_product = array_search($featured_prod_id, array_column($PRODUCTS_ARRAY, 'id') ); // So ? - no need to make a loop for retrieve key of an entry, this make sense for me in a context given. Commented Mar 31, 2022 at 23:43