Note that there are some explanatory texts on larger screens.

plurals
  1. POPushing a value onto the end of an array
    text
    copied!<p>I have the following array, it's full of gibberish (I got bored using lorem ipsum so I started typing random stuff -- I'm testing ¬_¬). </p> <p>I used mysqli_fetch_array to fetch this array.</p> <p>[array1]</p> <pre><code>Array ( [0] =&gt; Array ( [title] =&gt; this is a new thread, and it is great and it should work [thread_id] =&gt; 27 [content] =&gt; &lt;p&gt;hello, how are you? and what are you doing y'all and this should work&lt;/p&gt; [username] =&gt; umar [author_id] =&gt; 12 [tags] =&gt; Array ( [0] =&gt; lorem ) ) [1] =&gt; Array ( [title] =&gt; this is my second thread and it should work fine, just fine [thread_id] =&gt; 28 [content] =&gt; &lt;p&gt;this is is good, that I think it should have a thread of its own, don't you think?&lt;/p&gt; [username] =&gt; umarrazzaq [author_id] =&gt; 12 [tags] =&gt; Array ( [0] =&gt; thread [1] =&gt; less ) ) ) </code></pre> <p>I have another array [array2]:</p> <pre><code> Array ( [0] =&gt; Array ( [replies] =&gt; 2 [id] =&gt; 27 ) [1] =&gt; Array ( [replies] =&gt; 1 [id] =&gt; 28 ) ) </code></pre> <p>I want to push this second array onto the first array, where the IDs match.</p> <p>e.g. </p> <p>So the first array will become:</p> <pre><code> [0] =&gt; Array ( [title] =&gt; this is a new thread, and it is great and it should work [thread_id] =&gt; 27 [content] =&gt; &lt;p&gt;hello, how are you? and what are you doing y'all and this should work&lt;/p&gt; [username] =&gt; umar [author_id] =&gt; 12 [tags] =&gt; Array ( [0] =&gt; lorem ) **[replies] =&gt; 2** ) </code></pre> <p>I've tried passing by reference and using array_push in a foreach loop, but it only does it for one.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload