title: Laravel Collection update elements in loop
body: <p>I declared a variable of collect() data type. I want to iterate through it, and to update specific column on each row.</p>
  <p>The example code:</p>
  <pre class="lang-php prettyprint-override"><code>    $a = collect([
          ['one' =&gt; 1, 'two' =&gt; 2],
          ['one' =&gt; 3, 'two' =&gt; 4],
          ['one' =&gt; 5, 'two' =&gt; 6]
      ]);
  
      foreach ($a as $b) {
          $b['one'] = 0;
      }
  
      dd($a);
  </code></pre>
  <p>I don't understand, why the result is this:</p>
  <pre class="lang-none prettyprint-override"><code>
  Collection {#510 ▼
    #items: array:3 [▼
      0 =&gt; array:2 [▼
        &quot;one&quot; =&gt; 1
        &quot;two&quot; =&gt; 2
      ]
      1 =&gt; array:2 [▼
        &quot;one&quot; =&gt; 3
        &quot;two&quot; =&gt; 4
      ]
      2 =&gt; array:2 [▼
        &quot;one&quot; =&gt; 5
        &quot;two&quot; =&gt; 6
      ]
    ]
  }
  </code></pre>
  <p>I expect &quot;one&quot; =&gt; 0 as a result for each row.</p>