2014-04-07 27 views
0

我有以下字母排列字母排列不行

$_CharCodes = array(
        "A" => 01, "B" => 02, "C" => 03, "D" => 04, "E" => 05, "F" => 06, 
        "G" => 07, "H" => 08, "I" => 09, "J" => 10, "K" => 11, "L" => 12, 
        "M" => 13, "N" => 14, "O" => 15, "P" => 16, "Q" => 17, "R" => 18, 
        "S" => 19, "T" => 20, "U" => 21, "V" => 22, "W" => 23, "X" => 24, 
        "Y" => 25, "Z" => 26, 
        "SUPC" => 27, "SUBC" => 28, "SUPD" => 29, "SUBD" => 30, "DOT" => 31, "DASH" => 32       
        ); 

,當我用指數(是的,它是字母)測試數組的值,

echo 'a is: '.$this->_CharCodes[strtoupper("a")]."<br/>"; 
    echo 'b is: '.$this->_CharCodes[strtoupper("b")]."<br/>"; 
    echo 'c is: '.$this->_CharCodes[strtoupper("c")]."<br/>"; 
    echo 'd is: '.$this->_CharCodes[strtoupper("d")]."<br/>"; 
    echo 'e is: '.$this->_CharCodes[strtoupper("e")]."<br/>"; 
    echo 'f is: '.$this->_CharCodes[strtoupper("f")]."<br/>"; 
    echo 'g is: '.$this->_CharCodes[strtoupper("g")]."<br/>"; 
    echo 'h is: '.$this->_CharCodes[strtoupper("h")]."<br/>"; 
    echo 'i is: '.$this->_CharCodes[strtoupper("i")]."<br/>"; 
    echo 'j is: '.$this->_CharCodes[strtoupper("j")]."<br/>"; 
    echo 'k is: '.$this->_CharCodes[strtoupper("k")]."<br/>"; 
    echo 'l is: '.$this->_CharCodes[strtoupper("l")]."<br/>"; 
    echo 'm is: '.$this->_CharCodes[strtoupper("m")]."<br/>"; 
    echo 'n is: '.$this->_CharCodes[strtoupper("n")]."<br/>"; 
    echo 'o is: '.$this->_CharCodes[strtoupper("o")]."<br/>"; 
    echo 'p is: '.$this->_CharCodes[strtoupper("p")]."<br/>"; 
    echo 'q is: '.$this->_CharCodes[strtoupper("q")]."<br/>"; 
    echo 'r is: '.$this->_CharCodes[strtoupper("r")]."<br/>"; 
    echo 's is: '.$this->_CharCodes[strtoupper("s")]."<br/>"; 
    echo 't is: '.$this->_CharCodes[strtoupper("t")]."<br/>"; 
    echo 'u is: '.$this->_CharCodes[strtoupper("u")]."<br/>"; 
    echo 'v is: '.$this->_CharCodes[strtoupper("v")]."<br/>"; 
    echo 'w is: '.$this->_CharCodes[strtoupper("w")]."<br/>"; 
    echo 'x is: '.$this->_CharCodes[strtoupper("x")]."<br/>"; 
    echo 'y is: '.$this->_CharCodes[strtoupper("y")]."<br/>"; 
    echo 'z is: '.$this->_CharCodes[strtoupper("z")]."<br/>"; 

它像以下回報:

a is: 1 
b is: 2 
c is: 3 
d is: 4 
e is: 5 
f is: 6 
g is: 7 
h is: 0 
i is: 0 
j is: 10 
k is: 11 
l is: 12 
m is: 13 
n is: 14 
o is: 15 
p is: 16 
q is: 17 
r is: 18 
s is: 19 
t is: 20 
u is: 21 
v is: 22 
w is: 23 
x is: 24 
y is: 25 
z is: 26 

爲什麼它用於h &我返回0?

+0

你應該標籤這是什麼語言。 – crashmstr

回答

5

0109是由於導致0的八進制文字。 0809是無效的八進制文字(因爲您沒有標記任何語言,我不知道您的解釋器在這種情況下如何進行)。

嘗試刪除前導零。

((舊:「所有月份,不同的是OCTOBRE和septembre工作」 - 問題)。)