我有以下數組,它充滿了亂碼(我厭倦了使用lorem ipsum,所以我開始輸入隨機的東西 - 我正在測試¬_¬)。我使用mysqli_fetch_array獲取這個數組。將數值推到數組的末尾
[ARRAY1]
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
)
)
)
我有另一個數組[數組2]:
Array ([0] => Array ( [replies] => 2 [id] => 27)
[1] => Array ( [replies] => 1 [id] => 28))
欲這個第二陣列推到第一陣列,其中,所述ID匹配。
例如
所以第一個數組將變成:
[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,但它只做這一個。