I have a common pattern which Im sure there must be a built-in array function in PHP to handle but just can\'t see it.
I have multiple arrays such as the following:<
Before PHP 5.5, this would be the most efficient solution:
$key = 'key1'; $output = array_map(function($item) use ($key) { return $item[$key]; }, $testArray);
As of PHP 5.5, there is now an array_column function for this (see COil's answer).
array_column