title: Why is Array Merge Not Working in a For Loop
body: <p>In the for loop I am merging the arrays but only the last one is added at the end of the loop.</p>
  
  <pre><code>$result = json_decode($response['body']);
  
  if(isset($result-&gt;{'items'})) {
      $count = count($result-&gt;{'items'});
  } else {
     $count = 0;
  }
  $json = [];
  if($count &gt; 0) {
      for ($i=0; $i &lt; $count; $i++) {
          if (isset($result-&gt;{'items'}[$i]-&gt;{'title'})) {
              $title = $result-&gt;{'items'}[$i]-&gt;{'title'};
              $title_array = array('title' =&gt; $title);
              $json = array_merge($json, $title_array);
          }
      }
  }
  </code></pre>