Showing the last error first instead of first in PHP : <p>I have a login form currently setup that confuses my users.
The way i handle errors is like this;</p>

<pre><code>if (!($result-&gt;total &gt; 0)) {
$err[] = "License key is not in our system.";
}
if ($claimed == 1) {
err[] = 'License key has been claimed already.';
}
if ($userID &gt; 0) {
$err[] = 'License key is already connected to a user.';
}
if ($banned == 1) {
$err[] = 'License key is banned';
}
</code></pre>

<p>so for example, if one of my users would input a invalid license key instead of showing that it is not in our system it would show banned(creating confusion). Because i'm not exiting the code and letting it run.
I'm wondering how to go on about error handling when my functions are set up like this.</p>

<p>this is how i'm displaying the error..</p>

<pre><code>if (empty($err)) {
//no errors
} else {
echo $err; //this will show the last error instead of the first error generated
}
</code></pre>
