Quicker way of doing this
<p>I'm using PDO to get an array of relations from my DB.</p>

<pre><code>$dbRelaties = $dbh-&gt;query("SELECT pkRelatieId,naam,email FROM relaties");
</code></pre>

<p>in another function i need to acces one specific row in this array. I've managed to do it like this:</p>

<pre><code>$klant = array();
foreach($dbRelaties as $dbRelatie)
{
    if($dbRelatie["pkRelatieId"] == $relatie){ $klant = $dbRelatie; break; }
}
sendMail("Subject",$klant);
</code></pre>

<p>The above code works. But i'me looking for a neater solution and a quicker one, the above code is called in a function and that function is called inside a loop. So everytime it executes is has to loop through <code>$dbRelaties</code> to get the correct relation.</p>

<p>Can anyone set me in the right direction?</p>
