Why would php say two equal things are unequal?
<p>I'm trying to see if a user logging in has entered the right password, which is stored as an md5 hash. when i echo the hash of the password entered, it matches exactly the hash of the one in the database, but it still thinks its false. Heres the code:</p>

<pre><code>echo md5($_POST['pass']);

if ($user-&gt;match_password($_POST['pass']) == true) {

    ...

} else {

    ...

}
</code></pre>

<p>it tries to execute the else code above ^</p>

<pre><code>class user {

    ...

    var $password;

    ...

    function user($id) {
     global $DB;
     $this-&gt;db = new db($DB['host'], $DB['user'], $DB['pass'], $DB['database']);

     $this-&gt;user_id = $id;
     $u_result = $this-&gt;db-&gt;run("select * from users where use_id = " . $this-&gt;db-&gt;escape($this-&gt;user_id));

     ...

     $this-&gt;password = $u_reuslt[0]['password'];

            ...
    }

        ...

    function match_password($password) {
     return ($this-&gt;password == md5($password));
    } 
}
</code></pre>
