title: Foreach only returns 1st value
body: <p>I have a foreach code which should get all the values from an array, I call the return outside the foreach loop, but even so I still get only the first value.</p>
  
  <p>Here is the method I use:</p>
  
  <pre><code>public function getPriceItem($orderNumber){
    try {
      $query = "SELECT * FROM `orderlist` WHERE `orderNumber` = :orderNumber";
      $stmt = $this-&gt;dbh-&gt;prepare($query);
      $stmt-&gt;bindParam(":orderNumber", $orderNumber);
      $stmt-&gt;execute();
      $result = $stmt-&gt;fetchAll();
  
      $i = 0;
      $res = '';
      foreach ($result as $item) {
        $product_arr = explode (",", $item['productName']);
        // $price_arr = explode (",", $item['productPrice']);
        $qty_arr = explode (",", $item['qty']);
          $res .= '&lt;tr&gt;&lt;td&gt;'.$product_arr[$i].'(aantal'.$qty_arr[$i].')&lt;/td&gt;&lt;/tr&gt;';
          $i++;
      }
      return $res;
    } catch (Exception $e) {
      $this-&gt;error = $e-&gt;getMessage();
    }
  }
  </code></pre>
  
  <p>Any help would be appreciated. </p>