public static function cryptVerify($password, $hash)
    {
        $salt = substr($hash, 0, 2);
        try {
            // PHP 7 throws exception for invalid salt
            $actual = crypt($password, $salt);
        } catch (\Exception $e) {
            return false;
        }
        return ($actual === $hash);
    }
public static function cryptVerify($password, $hash)
    {
        $salt = substr($hash, 0, 2);
        try {
            // PHP 7 throws exception for invalid salt
            $actual = crypt($password, $salt);
        } catch (\Exception $e) {
            return false;
        }
        return ($actual === $hash);
    }
public static function cryptVerify ( $ password , $ hash ) { $ salt = substr ( $ hash , 0 , 2 ) ; try { // PHP 7 throws exception for invalid salt $ actual = crypt ( $ password , $ salt ) ; } catch ( \ Exception $ e ) { return false ; } return ( $ actual === $ hash ) ; }
Verifies a hash of CRYPT algorithm

@param string $password
@param string $hash
@return bool
Verifies a hash of CRYPT algorithm