title: PHP - Add a new element into each multidimensional array
body: <p>I have an array that looks like this:</p>
  <pre><code>Array
  (
      [0] =&gt; stdClass Object
          (
              [quiz_id] =&gt; 1033
              [quiz_venue] =&gt; 6
              [quiz_host] =&gt; 46
              [quiz_golden_question] =&gt; 100
              [quiz_golden_question_outcome] =&gt; 0
              [quiz_running] =&gt; 1
              [quiz_status] =&gt; 100
              [quiz_trainee] =&gt; 0
          )
  
      [1] =&gt; stdClass Object
          (
              [quiz_id] =&gt; 985
              [quiz_venue] =&gt; 57
              [quiz_host] =&gt; 21
              [quiz_golden_question] =&gt; 0
              [quiz_golden_question_outcome] =&gt; 0
              [quiz_running] =&gt; 1
              [quiz_status] =&gt; 310
              [quiz_trainee] =&gt; 0
          )
  </code></pre>
  <p>I want to go through each array, and insert a new value (quiz_venue_name), this is what I have;</p>
  <pre><code>$quizzes = $wpdb-&gt;get_results( $prepared );
  
          foreach ($quizzes as $quiz =&gt; $item) { 
              $venuetitle = get_the_title($item-&gt;quiz_venue);
              $quizzes['quiz_venue_name'] = $venuetitle;
          }
  
          return $quizzes;
  </code></pre>
  <p>However, all it does is add the new values to the very end of the multidimensional array as new arrays - rather than adding them into each!</p>
  <p>I feel like I'm doing something obvious wrong, so any help is much appreciated!</p>
  <p>The end result I need would be;</p>
  <pre><code>Array
  (
      [0] =&gt; stdClass Object
          (
              [quiz_id] =&gt; 1033
              [quiz_venue] =&gt; 6
              [quiz_host] =&gt; 46
              [quiz_golden_question] =&gt; 100
              [quiz_golden_question_outcome] =&gt; 0
              [quiz_running] =&gt; 1
              [quiz_status] =&gt; 100
              [quiz_trainee] =&gt; 0
  [quiz_venue_name] =&gt; NEW VALUE
          )
  
      [1] =&gt; stdClass Object
          (
              [quiz_id] =&gt; 985
              [quiz_venue] =&gt; 57
              [quiz_host] =&gt; 21
              [quiz_golden_question] =&gt; 0
              [quiz_golden_question_outcome] =&gt; 0
              [quiz_running] =&gt; 1
              [quiz_status] =&gt; 310
              [quiz_trainee] =&gt; 0
  [quiz_venue_name] =&gt; NEW VALUE
          )
  </code></pre>