从多维数组中获取用户ID数组[重复]

This question already has an answer here:

I've the following array:

Array
(
[0] => Array
    (
        [ID] => 1
        [more_user_data] => More
    )

[1] => Array
    (
        [ID] => 2
        [more_user_data] => More 
    )

)

Now I want to have a comma separated list of the IDs to use them in an own array. To get something like this:

array(1,2)

How could I only extract the IDs from the second array?

</div>

Use array_column() function like:

$arr = array_column($array, 'ID');

Working Example