0
$array = array(
   array(
      'display' => 'hi',
      'title' => 'hi'
   ),
   array(
      'display' => 'hi2',
      'title' => 'hi2'
   )
);

What I need is an array containing all of the display values.

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.