public function validatePasswordNotUseUsername($username, $password) {
        $washedPassword = trim($password);
        $washedPassword = strtolower($password);

        $washedUsername = trim($username);
        $washedUsername = strtolower($username);

        if ($washedPassword == $washedUsername) {
            return false;
        }

        // remove hyphens in the username, and compare again
        // maybe username "Bob Bloom" has password "bob-bloom"
        $washedUsernameHyphen = str_replace(" ", "-", $washedUsername);
        if ($washedPassword == $washedUsernameHyphen) {
            return false;
        }

        // remove underscores in the username, and compare again
        // maybe username "Bob Bloom" has password "bob_bloom"
        $washedUsernameUnderscore = str_replace(" ", "_", $washedUsername);
        if ($washedPassword == $washedUsernameUnderscore) {
            return false;
        }

        // remove spaces in the username, and compare again
        // maybe username "Bob Bloom" has password "bobbloom"
        $washedUsername = str_replace(" ", "", $washedUsername);
        if ($washedPassword == $washedUsername) {
            return false;
        }

        return true;
    }
public function validatePasswordNotUseUsername($username, $password) {
        $washedPassword = trim($password);
        $washedPassword = strtolower($password);

        $washedUsername = trim($username);
        $washedUsername = strtolower($username);

        if ($washedPassword == $washedUsername) {
            return false;
        }

        // remove hyphens in the username, and compare again
        // maybe username "Bob Bloom" has password "bob-bloom"
        $washedUsernameHyphen = str_replace(" ", "-", $washedUsername);
        if ($washedPassword == $washedUsernameHyphen) {
            return false;
        }

        // remove underscores in the username, and compare again
        // maybe username "Bob Bloom" has password "bob_bloom"
        $washedUsernameUnderscore = str_replace(" ", "_", $washedUsername);
        if ($washedPassword == $washedUsernameUnderscore) {
            return false;
        }

        // remove spaces in the username, and compare again
        // maybe username "Bob Bloom" has password "bobbloom"
        $washedUsername = str_replace(" ", "", $washedUsername);
        if ($washedPassword == $washedUsername) {
            return false;
        }

        return true;
    }
public function validatePasswordNotUseUsername ( $ username , $ password ) { $ washedPassword = trim ( $ password ) ; $ washedPassword = strtolower ( $ password ) ; $ washedUsername = trim ( $ username ) ; $ washedUsername = strtolower ( $ username ) ; if ( $ washedPassword == $ washedUsername ) { return false ; } // remove hyphens in the username, and compare again // maybe username "Bob Bloom" has password "bob-bloom" $ washedUsernameHyphen = str_replace ( " " , "-" , $ washedUsername ) ; if ( $ washedPassword == $ washedUsernameHyphen ) { return false ; } // remove underscores in the username, and compare again // maybe username "Bob Bloom" has password "bob_bloom" $ washedUsernameUnderscore = str_replace ( " " , "_" , $ washedUsername ) ; if ( $ washedPassword == $ washedUsernameUnderscore ) { return false ; } // remove spaces in the username, and compare again // maybe username "Bob Bloom" has password "bobbloom" $ washedUsername = str_replace ( " " , "" , $ washedUsername ) ; if ( $ washedPassword == $ washedUsername ) { return false ; } return true ; }
Password should not be the username

In my experience, some bots use the username as the password

@param  text  $username
@param  text  $password
@return bool
Password should not be the username