我有一个 sql 查询,它为我提供以下格式的数组。基本上,第零个元素是 event_id,第一个元素是与事件相关的 photo_id。以下是数组
Array
(
[0] => Array
(
[0] => 1
[1] => 1
)
[1] => Array
(
[0] => 1
[1] => 2
)
[2] => Array
(
[0] => 1
[1] => 3
)
[3] => Array
(
[0] => 0
[1] => 4
)
[4] => Array
(
[0] => 0
[1] => 5
)
[5] => Array
(
[0] => 1
[1] => 6
)
[6] => Array
(
[0] => 0
[1] => 7
)
[7] => Array
(
[0] => 1
[1] => 8
)
[8] => Array
(
[0] => 0
[1] => 9
)
[9] => Array
(
[0] => 1
[1] => 10
)
[10] => Array
(
[0] => 2
[1] => 11
)
[11] => Array
(
[0] => 2
[1] => 12
)
)
我需要将所有第零个元素转换为键,将第一个元素转换为值。即所有相同的事件ID 都有自己的一组照片。所以输出应该像:
array(
[1]=>[1,2,3,6,8,10]
[0]=>[4,5,7,9]
[2]=>[11,12]
谢谢 !