Reputation: 20845
I have an array
<?php
array (
0 => array ( 'name' => 'id', 'type' => 'integer', 'null' => 'NO', ),
1 => array ( 'name' => 'strasse', 'type' => 'string', 'null' => 'YES', ),
#...
)
How do I get an array with all the names or with only all the types?
like:
array('id','name',...)
Upvotes: 0
Views: 47
Reputation: 219824
In PHP 5.5 you can use array_column()
$names = array_column($array, 'name');
// array('id','strasse',...)
Upvotes: 2