public static function encrypt($string, $key) {
        $result = '';
        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 base64_encode($result);
    }
public static function encrypt($string, $key) {
        $result = '';
        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 base64_encode($result);
    }
public static function encrypt ( $ string , $ key ) { $ result = '' ; 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 base64_encode ( $ result ) ; }
Basic encryption method.

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

@param string $string the string that needs encryption.
@param string $key    a key string for the encryption.

@return string the encrypted string.
Basic encryption method .