array_column( array $input , $column_key , $index_key)
第一个参数为原始数组,第二个参数(多维数组键名)为新数组的值,第三个参数(多维数组键名)为键.结果为一个键值对数组


$array = [
     [ 'id' => 1, 'name' => 'tom' , 'age' => 18],
     [ 'id' => 2, 'name' => 'jack' , 'age' => 19],
     [ 'id' => 3, 'name' => 'mick' , 'age' => 20],
     [ 'id' => 4, 'name' => 'lucy' , 'age' => 21],
     [ 'id' => 5, 'name' => 'bill' , 'age' => 22],
];
 
$arr = array_column( $array , 'name' , 'id' );
 
echo '<pre>' ;
print_r( $arr );
 
result:
Array
(
     [1] => tom
     [2] => jack
     [3] => mick
     [4] => lucy
     [5] => bill
)