title: How do I specify the fetch_style when using a PDO prepared statement and the traversal interface?
body: <p>My pdo connection is set up to return standard objects, and I can use the traversal interface to iterate over the results as follows:</p>
  
  <pre><code>$stmt=$this-&gt;pdo-&gt;prepare($sql);
  $stmt-&gt;execute($arr);
  foreach($stmt as $rs) {
      //$rs is a stdObject since the pdo connection is set up to return stdObjects
  }
  </code></pre>
  
  <p>Per <a href="http://php.net/manual/en/pdo.query.php" rel="nofollow noreferrer">http://php.net/manual/en/pdo.query.php</a>, I can specify the fetch_style and similarily itterate over the results as follows:</p>
  
  <pre><code>$stmt = $pdo-&gt;query($sql, PDO::FETCH_ASSOC);
  foreach($stmt as $rs) {
      //$rs is an array even though pdo connection is set up to return stdObject since I included `PDO::FETCH_ASSOC`
  }
  </code></pre>
  
  <p>What I want, however, is to use a prepared statement when my pdo connection is set up to return standard objects, and use the traversal interface to iterate over the results and return arrays:</p>
  
  <pre><code>$stmt=$this-&gt;pdo-&gt;prepare($sql);
  $stmt-&gt;execute($arr);
  foreach($stmt as $rs) {
      // pdo connection is set up to return stdObject.  What can be done to make $rs an array?
  }
  </code></pre>
  
  <p>How can this be done?</p>
  
  <p>Note that typecasting to an array is not an acceptable answer as not using the traversal interface in the first place would be a better approach.</p>
  
  <p>However, stating that it is not possible (if true) is an acceptable answer.</p>