我有功能,其編碼編號,以像字符串:如何從信件中獲取反向號碼?
- 0 - >一個
- 1 - >乙
- 2 - > C^
- ...
- 45 - >ř
功能:
public static function encode($number) {
$out = "";
$codes = "abcdefghjkmnpqrstuvwxyz23456789ABCDEFGHJKMNPQRSTUVWXYZ";
while ($number > 53) {
$key = $number % 54;
$number = floor($number/54) - 1;
$out = $codes{$key}.$out;
}
return $codes{$number}.$out;
}
如何製作將字母轉換回數字的反轉功能?
你應該看看strpos函數給你一個字符串的位置: http://php.net/manual/en/function.strpos.php – Yoleth
重新創建ASCII表嗎? – RomanPerekhrest
根據你的代碼,如果給定的數字大於53,這意味着什麼? – Perumal