Add previous value in foreach - PHP
<p>Let's say I have data string like this...</p>

<pre><code>one=1&amp;two=2&amp;three=3&amp;four=4&amp;two=2
</code></pre>

<p>I'm using php <code>foreach</code> to grab the key/value and sort how I need it at this point</p>

<pre><code>foreach($_POST as $key =&gt; $value) {
   if ($key == "two") {
    // $result = Take $value and add it to the previous $value .",";
   }
}
</code></pre>

<p>The goal I am trying to reach is how do I take the duplicate keys and add the previous value generated in the loop. For example: The solution would be <code>$result = 2,2,</code></p>
