【发布时间】:2018-12-01 06:02:40
【问题描述】:
我有一个如下所示的数组:
array:9 [▼
0 => {#279 ▼
+"id": "103"
+"name": "In what city did you meet your spouse/partner?"
}
1 => {#280 ▼
+"id": "100"
+"name": "What is the first name of the person you first kissed?"
}
2 => {#281 ▼
+"id": "102"
+"name": "What is the name of your favorite childhood friend?"
}
3 => {#282 ▶}
4 => {#283 ▶}
5 => {#284 ▶}
6 => {#285 ▶}
7 => {#286 ▶}
8 => {#287 ▶}
]
这是 dd()。我想知道如何将其转换为键/值数组,使用 id 作为键和名称作为值。像这样的:
array(
'103' => 'In what city did you meet your spouse/partner?',
'100' => 'What is the first name of the person you first kissed?'
);
【问题讨论】: