title: While loop VS. $sqlResult -> fetch_all(MYSQLI_ASSOC) ;
body: <p>Not exactly sure why but I've seen this come up a number of times today. </p>
  
  <pre><code>global $connection;
  $sql = "SELECT * FROM table";
  
  $result = $connection-&gt;query($sql);
  
  $rows = array();
  while ($row = mysqli_fetch_assoc($result)) {
  
      $rows[] = $row;
  
  }
  
  return $rows;
  </code></pre>
  
  <p>Why not just use the built in function of <strong>fetch_all</strong></p>
  
  <pre><code>global $connection;
  $sql = "SELECT * FROM table";
  
  $result = $connection-&gt;query($sql);
  
  return $result-&gt;fetch_all(MYSQLI_ASSOC);
  </code></pre>
  
  <p>Wouldn't this render the while loop unnecessary? 
  Any advantages? 
  Speed differences?</p>