As a multi-dimensional array to turn into a one-dimensional?

This:
array(5372) {
[0]=>
 array(1) {
["id"]=>
 string(4) "1338"
}
[1]=>
 array(1) {
["id"]=>
 string(4) "3727"
}
[2]=>
 array(1) {
["id"]=>
 string(4) "3849"
 }

You need to:
[0] => 1338
[1] => 3727
[2] => 3849

It is clear that through the cycle you can make an overflow of values in a new array, but is there anything more chic?
July 2nd 19 at 18:14
2 answers
July 2nd 19 at 18:16
Solution
array_column()

$input = array(
array(
 "id" => "1338",
),
array(
 "id" => "3727",
),
array(
 "id" => "3849",
)
);

var_dump(array_map('intval', array_column($input, 'id')));
July 2nd 19 at 18:18
it's not an associative array. you have an array of arrays
mapie your top array to a function which is $item=$item['id']
Changed the title of your question, the theme MapIT not disclosed (( For the function on each element of the array is even resursozatratno will be something in a new array pour. - Tyreek.Stoke commented on July 2nd 19 at 18:21
: not a bit expensive. I don't know, it must be under a million items to have in the array to see at least some more or less noticeable difference. - mina50 commented on July 2nd 19 at 18:24
significant at least at 0.1 seconds - mina50 commented on July 2nd 19 at 18:27

Find more questions by tags PHP