PHP hexadecimal() 函數用於將十六進製數轉換為十進製數。它將十六進製字符串的十進製等效值返回為十進製數。
用法:
number hexdec ( string $hex_string )
參數 | 描述 | 必需/可選 |
---|---|---|
hex_string | 要轉換的十六進製字符串 | Required |
例子1
<?php
$nos="1e";
echo "Your number is:".$nos;
echo "<br>"."By using 'hexdec()' function your value is:".(hexdec($nos));
?>
輸出:
Your number is:1e By using 'floor()' function your value is:30
例子2
<?php
$nos="a";
echo "Your number is:".$nos;
echo "<br>"."By using 'hexdec()' function your value is:".(hexdec($nos));
?>
輸出:
Your number is:a By using 'hexdec()' function your value is:10
例子3
<?php
$nos="11ff";
echo "Your number is:".$nos;
echo "<br>"."By using 'hexdec()' function your value is:".(hexdec($nos));
?>
輸出:
Your number is:11ff By using 'floor()' function your value is:4607
示例 4
<?php
$nos="cceeff";
echo "Your number is:".$nos;
echo "<br>"."By using 'hexdec()' function your value is:".(hexdec($nos));
?>
輸出:
Your number is:cceeff By using 'hexdec()' function your value is:13430527
相關用法
- PHP hexdec( )用法及代碼示例
- PHP hex2bin()用法及代碼示例
- PHP headers_list()用法及代碼示例
- PHP header()用法及代碼示例
- PHP headers_sent()用法及代碼示例
- PHP hash_hmac()用法及代碼示例
- PHP hash_algos()用法及代碼示例
- PHP hrtime()用法及代碼示例
- PHP highlight_string()用法及代碼示例
- PHP html_entity_decode()用法及代碼示例
- PHP hash_copy()用法及代碼示例
- PHP hash_hmac_file()用法及代碼示例
- PHP hash_equals()用法及代碼示例
- PHP hash_file( )用法及代碼示例
- PHP highlight_file()用法及代碼示例
- PHP hypot()用法及代碼示例
- PHP hash_pbkdf2()用法及代碼示例
- PHP http_build_query()用法及代碼示例
- PHP htmlentities() vs htmlspecialchars()用法及代碼示例
- PHP htmlentities()用法及代碼示例
注:本文由純淨天空篩選整理自 PHP hexadec() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。