【PHP】36進位轉換10進位,base_convert函數用法。


這幾天一直考慮36進位問題,還好在【廢人廢業誌】看到string base_convert ( string $number , int $frombase , int $tobase )的用法。
這個函數,可以自訂任意進位來轉換。

# 36進位轉換10進位 #
base_convert($hexadecimal, 36, 10);
# 10進位轉換36進位 #
base_convert($hexadecimal, 10, 36);

# 24進位轉換10進位 #
base_convert($hexadecimal, 24, 10);
# 10進位轉換24進位 #
base_convert($hexadecimal, 10, 24);

【參考】
http://note.junk.tw/2010/09/php-3610.html
http://php.net/manual/zh/function.base-convert.php

這個網誌中的熱門文章

如何檢查電腦是否中了後門程式

Putty 白底黑字設定