PHP PDO + copy out Array
<p>I have a PDO Query that returns what appears to be an array $pds. I can loop through this array as follows:</p>

<pre><code>foreach ($pds as $row) {

 }
</code></pre>

<p>I need to loop through the same array a second time but when I do this there doesn't appear to be any data in the array. Also I've tried to copy the array as follows:</p>

<pre><code> $pds2 = $pds;
</code></pre>

<p>Is there a trick I'm missing to use this array twice?</p>

<p>thx</p>

<p>Code:</p>

<pre><code>        // Remove Duplicate Locations where words are in a different order
        $cityArray = $pds;

        foreach ($cityArray as $data) {
            $words = explode(' ', $data['city'] . ' ' . $data['region1'] . ' ' . $data['region2'] . ' ' . $data['region3']);
            sort($words);
            $cityWordsArray[$data['id']] = implode(' ', $words);
        }
        $cityWordsArray = array_unique($cityWordsArray);

        foreach ($pds as $row) {
            echo 'hi';
            foreach($cityWordsArray as $key=&gt;$value) {
                if($row['id'] == $key) {
</code></pre>
