public static function decrypt($string, $key) {
        $result = '';
        $string = base64_decode($string);

        for ($i=0; $i<strlen($string); $i++) {
            $char = substr($string, $i, 1);
            $keychar = substr($key, ($i % strlen($key))-1, 1);
            $char = chr(ord($char)-ord($keychar));
            $result .= $char;
        }

        return $result;
    }
public static function decrypt($string, $key) {
        $result = '';
        $string = base64_decode($string);

        for ($i=0; $i<strlen($string); $i++) {
            $char = substr($string, $i, 1);
            $keychar = substr($key, ($i % strlen($key))-1, 1);
            $char = chr(ord($char)-ord($keychar));
            $result .= $char;
        }

        return $result;
    }
public static function decrypt ( $ string , $ key ) { $ result = '' ; $ string = base64_decode ( $ string ) ; for ( $ i = 0 ; $ i < strlen ( $ string ) ; $ i ++ ) { $ char = substr ( $ string , $ i , 1 ) ; $ keychar = substr ( $ key , ( $ i % strlen ( $ key ) ) - 1 , 1 ) ; $ char = chr ( ord ( $ char ) - ord ( $ keychar ) ) ; $ result .= $ char ; } return $ result ; }
Basic decryption method.

http://www.tfonfara.de/php-encryptdecrypt-funktion-mit-base64-und-schlussel.xhtml

@param string $string a string encrypted by THETOOLS::encrypt().
@param string $key    a key string for the decryption.

@return string the decrypted string.
Basic decryption method .