다음 배열을 가지고 있는데, 헛소리로 가득 차 있습니다 (lorem ipsum을 사용하여 지루해 졌으므로 임의의 내용을 입력하기 시작했습니다 - 저는 ¬_¬을 테스트 중입니다).배열 끝으로 값 밀어 내기
이 배열을 가져 오기 위해 mysqli_fetch_array를 사용했습니다.
Array ([0] => Array ( [replies] => 2 [id] => 27)
[1] => Array ( [replies] => 1 [id] => 28))
제가 제 배열 IDS는 매치에이 제 2 어레이를 푸시 할 :
는 [배열 1]
Array
(
[0] => Array
(
[title] => this is a new thread, and it is great and it should work
[thread_id] => 27
[content] => <p>hello, how are you? and what are you doing y'all and this should work</p>
[username] => umar
[author_id] => 12
[tags] => Array
(
[0] => lorem
)
)
[1] => Array
(
[title] => this is my second thread and it should work fine, just fine
[thread_id] => 28
[content] => <p>this is is good, that I think it should have a thread of its own, don't you think?</p>
[username] => umarrazzaq
[author_id] => 12
[tags] => Array
(
[0] => thread
[1] => less
)
)
)
I 다른 배열 [배열 2]이있다.
그래서 첫 번째 배열이 될 것입니다 :
[0] => Array
(
[title] => this is a new thread, and it is great and it should work
[thread_id] => 27
[content] => <p>hello, how are you? and what are you doing y'all and this should work</p>
[username] => umar
[author_id] => 12
[tags] => Array
(
[0] => lorem
)
**[replies] => 2**
)
내가 참조로 전달하고 foreach 루프에서 array_push 사용하여 시도했지만, 그것은 단지 하나를 수행합니다.
foreach($array1 as $key=>&$arr){
$arr['replies'] = $array2[$key]['replies']
}