如何重新格式化對象?重新格式化一個簡單的PHP數組
Array
(
[0] => Array
(
[user_id] => 5
[first_name] => Ace
[last_name] => Black
)
[1] => Array
(
[user_id] => 6
[first_name] => Gary
[last_name] => Surname
)
[2] => Array
(
[user_id] => 7
[first_name] => Alan
[last_name] => Person
)
)
我需要重新格式化此所以user_ID的名稱更改爲剛剛「ID」和FIRST_NAME和LAST_NAME值被合併到一個名爲「名稱」的單一值,因此最終的結果會是什麼樣子:
Array
(
[0] => Array
(
[id] => 5
[name] => Ace Black
)
)