3
공통 값을 기반으로 배열을 재 그룹화하는 방법에 대해서는 약간 혼동 스럽습니다. 여기에 아래의 배열입니다 :php 다차원 배열 그룹화
Array
(
[0] => Array
(
[team] => 1
[id] => 5
[user] => teamleader1
[Designation] => Team Leader
)
[1] => Array
(
[team] => 1
[id] => 6
[user] => consultant1
[Designation] => Consultant
)
[2] => Array
(
[team] => 1
[id] => 7
[user] => consultant2
[Designation] => Consultant
)
[3] => Array
(
[team] => 2
[id] => 8
[user] => consultant3
[Designation] => Consultant
)
[4] => Array
(
[team] => 2
[id] => 9
[user] => teamleader2
[Designation] => Team Leader
)
)
와 나는 아래와 같은 그 팀 값 그룹 그것을 싶습니다
Array ( [1] => Array ( [0] => Array( [team] => 1 [id] => 5 [user] =>teamleader1 [Designation] => Team Leader ) [1] => Array( [team] => 1 [id] => 6 [user] =>consultant1 [Designation] => Consultant ) [2] => Array( [team] => 1 [id] => 7 [user] =>consultant2 [Designation] => Consultant ) ) [2] => Array ( [0] => Array( [team] => 1 [id] => 8 [user] =>consultant3 [Designation] => Consultant ) [1] => Array( [team] => 1 [id] => 9 [user] =>teamleader2 [Designation] => Team Leader ) ) )
두 가지 주요 배열 그룹이 팀 자체입니다. 모든 아이디어/도움을 많이 주시면 감사하겠습니다. 미리 감사드립니다!
안부가 존재하지 않는 경우
는 isset 확인 할 필요는, PHP는 당신을 위해 그것을 만듭니다. – hakre
이것은 비명을 지른다. 그러나 PHP5.3은 실제로 그것을 발생시키지 않습니다. 그걸 몰랐는데 ... - 여전히 이상하게 보입니다. – rodneyrehm
이것은 통지하지 않습니다. http://codepad.org/VdoMnfTD, PHP 5.2 : http://ideone.com/vPTKw – hakre