I have the following array $foo
array(10) {
[0] => array(4) {
[\"merchantId\"] => string(5) \"12e21\"
[\"programId\"] => string(27) \"ffffd3333\"
[\"
As an alternative to array_column()
$transpose = call_user_func_array(
'array_map',
array_merge(
array(NULL),
$data
)
);
$result = $transpose[array_search("programId", array_keys($data[0]))];
var_dump($result);
Which can be done as a one-liner in PHP5.5
$result = call_user_func_array('array_map',array_merge(array(NULL),$data))[array_search("programId", array_keys($data[0]))];
var_dump($result);
I'll confess, it's not exactly intuitive or readable though