我有一個具有以下值的二維數組: [ 'id' => 12, 'title' => 'the title', //and a few other key => value ], [ 'id' => 13, 'title' => 'the title 13', // and a few other key => value ],...最后,我需要一個只有id 和 title的多維數組[ $item['id'] => $item['title'], ...]通常,我會做一個簡單的 foreach 來實現這一點,但我現在想使用 php 函數。我已經這樣做了,但是有正確的方法嗎?$list = array_combine(array_column($list_forms, 'id'), array_column($list_forms, 'title'));
- 1 回答
- 0 關注
- 95 瀏覽
添加回答
舉報
0/150
提交
取消