public static function encode($data, $pad = null) {
		$str = str_replace(array('+', '/'), array('-', '_'), base64_encode($data));
		if (!$pad) {
			$str = rtrim($str, '=');
		}
		return $str;
	}
public static function encode($data, $pad = null) {
		$str = str_replace(array('+', '/'), array('-', '_'), base64_encode($data));
		if (!$pad) {
			$str = rtrim($str, '=');
		}
		return $str;
	}
public static function encode ( $ data , $ pad = null ) { $ str = str_replace ( array ( '+' , '/' ) , array ( '-' , '_' ) , base64_encode ( $ data ) ) ; if ( ! $ pad ) { $ str = rtrim ( $ str , '=' ) ; } return $ str ; }
encode a string

@param string $data
@param string $pad
@return string
encode a string