Sum of elements in foreach yii2
<p>I have this in my gridview:</p>

<pre><code>[
    'value' =&gt; function ($data) {
        $summ = 0;
        $str = 0;
        foreach($data-&gt;itemsOrder as $request) {
            $str .= $request-&gt;order_items_quantity;
            $summ += $str;
        }

        return $summ;
    },
],
</code></pre>

<p>I get something like that '123' in column cell, but not '6'. How Could I get sum of elements?</p>