Return only unique values from foreach
<p>I'm currently trying to use a foreach to return all the addresses using the relation from my event model. All is fine, returns all the addresses but will return even the duplicate results. I tried the array_unique but not sure I have the syntax correct.</p>

<pre><code>&lt;?php  
    foreach ($data-&gt;events as $address) {
        //array_unique($address, SORT_REGULAR);
        echo $address-&gt;getAddressString() ."&lt;br/&gt; &lt;br/&gt;";
    }
  ?&gt;
</code></pre>