private function createSalt($max = 15)
    {
        $characterList = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        $i = 0;
        $salt = "";
        do {
            $salt .= $characterList{mt_rand(0,strlen($characterList)-1)};
            $i++;
        } while ($i < $max);

        return $salt;
    }
private function createSalt($max = 15)
    {
        $characterList = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        $i = 0;
        $salt = "";
        do {
            $salt .= $characterList{mt_rand(0,strlen($characterList)-1)};
            $i++;
        } while ($i < $max);

        return $salt;
    }
private function createSalt ( $ max = 15 ) { $ characterList = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" ; $ i = 0 ; $ salt = "" ; do { $ salt .= $ characterList { mt_rand ( 0 , strlen ( $ characterList ) - 1 ) } ; $ i ++ ; } while ( $ i < $ max ) ; return $ salt ; }
Generate a salt for storing the encrypted password

Taken from http://code.activestate.com/recipes/576894-generate-a-salt/

@param int $max Length of salt
@return string
Generate a salt for storing the encrypted password