Foreach to change a key
<p>I retrieve a set of mysql row as an array of associative arrays (I'm using pdo fetch all). My associative arrays holds a key named "password". How do I loop throught the arrays to change all the password values? I need to set them to 0 if the password is equal to 0, 1 instead.</p>

<pre><code>$result = $stmt-&gt;fetchAll(PDO::FETCH_ASSOC);
/* gotta strip all the password, I can't send them! */
foreach($result as $res)   $res['password'] = (!$res['password']) ? 0 : 1; 
</code></pre>
