title: How to get the contents of an associative array returned by pdo into an array
body: <p>I am using PHO PDO and getting it to return an associative array.</p>
  
  <p>I can loop through the associative array created by PDO, but I cant work out how to return the array from a function.</p>
  
  <pre><code>function wantedrentals($provence, $country, $dbh)
     {
        echo "Now in wanted wanted rentals function&lt;br&gt;&lt;br&gt;"; 
  
        $journeyrentalssarray = array();
  
        $sth = $dbh-&gt;query("SELECT summary, url, provence, country from tblAccomadation WHERE country = $country ");
  
      # setting the fetch mode
      $sth-&gt;setFetchMode(PDO::FETCH_ASSOC);
  
      while($row = $sth-&gt;fetch()) 
          {
              echo $row['summary'] . "\n";
              echo $row['url'] . "\n";
              echo $row['provence'] . "\n";
              echo $row['country'] . "\n";
          }
  
    return $journeyrentalssarray;
    }
  </code></pre>
  
  <p>I am very new to PHP and PDO and would appreciate any help.</p>