arrays and foreach
<p>Any idea why this wont print the errors?</p>

<pre><code>// Validate the email
if (preg_match($regex, $email))  
        $errors[] = "Invalid email address";

    // ... and the password
    if (strlen($password) &lt; 4)
        $errors[] = "Password is too short";

    // No errors?   
    if (empty($errors))
    {
        // insert into db

    }

// If there were any errors, show them
if (!empty($errors))
{
    $errors = array();
    foreach ($errors as $error)
    echo '&lt;li&gt;'.$error.'&lt;/li&gt;';
}
</code></pre>
