Ich habe ein Array wie folgt. Es gibt einige Arrays mit demselben Namen. Wie Grant 1, Grant 2 ... und sie haben viele Projekte, die am selben Ort sein sollten. Zum Beispiel: Grant-1 sollte die Information enthält, dass 1. die gleiche Sache Grant gehört, 2. zu gewähren, und so weiterWie kombiniere ich Multi - Arrays mit der gleichen Taste?
array:5 [▼
0 => array:2 [▼
0 => "Grant 1"
1 => Project {#423 ▶}
]
1 => array:2 [▼
0 => "Grant 1"
1 => Project {#421 ▶}
]
2 => array:2 [▼
0 => "Grant 2"
1 => Project {#412 ▶}
]
3 => array:2 [▼
0 => "Grant 1"
1 => Project {#424 ▶}
]
4 => array:2 [▼
0 => "Grant 2"
1 => Project {#419 ▶}
]
]
ich sie kombinieren will passieren soll: Bitte
array:5 [▼
0 => array:2 [▼
0 => "Grant 1"
1 => Project {#423 ▶}
2 => Project {#421 ▶}
3 => Project {#424 ▶}
]
1 => array:2 [▼
0 => "Grant 1"
1 => Project {#412 ▶}
2 => Project {#419 ▶}
]
]
Hilfe. Danke,
Vielen Dank Iwan! Du hast mein Leben gerettet @. @ –
Zweite Foreach nicht benötigt: 'foreach ($ Array als $ Wert) { if (isset ($ newArray [$ Wert [0])) { $ newArray [$ Wert [0]] [ ] = $ value [1]; } sonst { $ newArray [$ value [0]] = $ value; } } ' – AbraCadaver
@AbraCadaver ja, es ist gut. Vielen Dank. – Iwan