나는 병합 배열을 병합 (병합)하고 싶습니다. 실제 코드는 다음과 같습니다연관 배열 하위를 병합 또는 결합
Array
(
[0] => Array
(
[Id_Usager] => 291
[etat_lundi] => livree
[Date_lundi] => 2011-12-26
[etat_mardi] => livree
[Date_mardi] => 2011-12-27
[etat_mercredi] => livree
[Date_mercredi] => 2011-12-28
[etat_jeudi] => livree
[Date_jeudi] => 2011-12-29
[etat_vendredi] => livree
[Date_vendredi] => 2011-12-30
[etat_samedi] => livree
[Date_samedi] => 2011-12-31
[etat_dimanche] => livree
[Date_dimanche] => 2012-01-01
)
[1] => Array
(
[Id_Usager] => 291
[etat_lundi] => livree
[Date_lundi] => 2012-01-02
[etat_mardi] => livree
[Date_mardi] => 2012-01-03
[etat_mercredi] => en_cours
[Date_mercredi] => 2012-01-04
[etat_jeudi] => en_cours
[Date_jeudi] => 2012-01-05
[etat_vendredi] => en_cours
[Date_vendredi] => 2012-01-06
[etat_samedi] => en_cours
[Date_samedi] => 2012-01-07
[etat_dimanche] => en_cours
[Date_dimanche] => 2012-01-08
)
)
내가 말하고자하는 것은입니다 :
- 설정 해제 첫 번째 요소 (
Id_Usager
) - 하나
- (호환) 쌍에 부분 배열을 병합,
etat
를 이동하여 값 ([etat_lundi] =>livree
)을Date
키 ([Date_lundi] =>2012-01-02
)
Array(
[0] => Array(
[livree] => 2011-12-26
[livree] => 2011-12-27
[livree] => 2011-12-28
[livree] => 2011-12-29
[livree] => 2011-12-30
[livree] => 2011-12-31
[livree] => 2012-01-01
[livree] => 2012-01-02
[livree] => 2012-01-03
[en_cours] => 2012-01-04
[en_cours] => 2012-01-05
[en_cours] => 2012-01-06
[en_cours] => 2012-01-07
[en_cours] => 2012-01-08
)
)
내가 이걸 어떻게해야합니까
:내가 가지고 싶은 결과 배열이 무엇입니까? 귀하의 경우에는
키가 고유해야하므로 의미가 없습니다. – Paulpro
여기있는 모든 사람들이 지적했듯이 이것은 불가능합니다. 배열의 중복 된 키 항목을 만들려고 할 수도 있습니다 (그래서 [0] [ 'Id_Usager'] = array (291,291)). 그러나 이것은 당신이 무엇을하려고하는지에 달려 있습니다. 배열을 이렇게 형식화하는 이유는 무엇입니까? –
원하는 결과 배열에 같은 id와 다른 값을 가진 두 개의 항목이 있습니다. 어떻게 가능합니까? [Date_mardi] => 2011-12-27 [Date_mercredi] => 2012-01-04 –