private function analysis()
 {
     if (DEBUG && DEBUG_LEVEL & EQR_ANALYSIS) {
         $debug = true;
     } else {
         $debug = false;
     }
     $this->length = strlen($this->string);
     $this->encode = EM_NUM;
     for ($i = 0; $i < $this->length; $i++) {
         $ascii = ord(substr($this->string, $i, 1));
         if ($ascii < 0x30 || $ascii > 0x39) {
             if ($ascii >= 0x41 && $ascii <= 0x5a || $ascii == 0x20 || $ascii == 0x24 || $ascii == 0x25 || $ascii == 0x2a || $ascii == 0x2b || $ascii == 0x2d || $ascii == 0x2e || $ascii == 0x2f || $ascii == 0x3a) {
                 $this->encode = EM_ALP;
             } else {
                 $this->encode = EM_BIN;
                 break;
             }
         }
     }
     $this->version = -1;
     for ($i = 1; $i <= MAX_VER; $i++) {
         if (Qrcode::getCapacity($i, $this->errorLevel, $this->encode) >= $this->length) {
             $this->version = $i;
             $this->dataBits = Qrcode::getCapacity($i, $this->errorLevel, DATA_BITS);
             break;
         }
     }
     if ($this->version == -1) {
         echo "String too long";
         exit;
     }
     switch ($this->version) {
         case 2:
         case 3:
         case 4:
         case 5:
         case 6:
             $this->remBits = 7;
             break;
         case 14:
         case 15:
         case 16:
         case 17:
         case 18:
         case 19:
         case 20:
         case 28:
         case 29:
         case 30:
         case 31:
         case 32:
         case 33:
         case 34:
             $this->remBits = 3;
             break;
         case 21:
         case 22:
         case 23:
         case 24:
         case 25:
         case 26:
         case 27:
             $this->remBits = 4;
             break;
         default:
             $this->remBits = 0;
             break;
     }
     if ($debug) {
         printf("Version = %d <br>String Length= %d<br>Reminder Bits = %d<br>" . "Error level (0=M, 1=L, 2=H, 3=Q)= %d<br>Encode Mode (1=Numeric, " . "2=Alphanumeric, 4=8-bit Byte, 8=Kanji)= %d<br> Capacity = %d <br>", $this->version, $this->length, $this->remBits, $this->errorlevel, $this->encode, $this->capacity[$this->version][$this->errorLevel]);
     }
 }