In PHP, is there a function that returns an array made up of the value of a key from an array of associative arrays?

前端 未结 8 1217
梦谈多话
梦谈多话 2020-12-08 14:44

I\'m sure this question has been asked before, my apologies for not finding it first.

The original array:

[0] => Array
    (
        [categoryId]          


        
8条回答
  •  情深已故
    2020-12-08 15:22

    You could use array_filter, and pass in a function based on the desired key.

    Tadeck's answer is way better though.

提交回复
热议问题