Reputation: 9040
$array = array(
array(
'display' => 'hi',
'title' => 'hi'
),
array(
'display' => 'hi2',
'title' => 'hi2'
)
);
What I need is an array containing all of the display
values.
Upvotes: 0
Views: 31
Reputation: 59701
This is perfect for array_column()
. You can use it like this:
$values = array_column($array, "display");
print_r($values);
Output:
Array ( [0] => hi [1] => hi2 )
For more information about array_column()
see the manual: http://php.net/manual/en/function.array-column.php
Upvotes: 3