How do i explode multiple comma separated lists into a single foreach?
<p>Let's say I have these 2 comma separated lists:</p>

<pre><code>$quantity = "5000,10000";
$cost = "2.00,1.00";
</code></pre>

<p>Then I explode quantity to echo out each list item like this:</p>

<pre><code>$quantity_explode = explode(",", $quantity);
foreach($quantity_explode as $quantity_value){
    echo $quantity_value . PHP_EOL; //PHP_EOL is same as \n
}
</code></pre>

<p>The result of that is:</p>

<pre><code>5000
10000
</code></pre>

<p>But what I really want to display is this:</p>

<pre><code>5000 2.00
10000 1.00
</code></pre>

<p>How do I incorporate the second list into the first list? The 1st value of 2nd list belongs to the 1st value of 1st list. The 2nd value of 2nd list belongs to the 2nd value of 1st list. And so on.</p>

<p>I don't think it's a second explode and second foreach after first explode and foreach (then do some kind of weird merge?). Do I do 2nd explode and foreach inside the first foreach?</p>