PHP-dechex():10進数を16進数に変換


PHP関数
dechex
サマリ
10進数を16進数に変換します.
関数プロトタイプ
dechex ( int $num ) : string
パラメータ$num変換する10進数.
PHPのintタイプは符号を有するが、dechex()は符号なし整数を扱うので、負の整数は符号なしとみなす.
説明:
PHP 4バージョンから提供されます.
指定された符号なし$num引数の16進数表現を含む文字列を返します.
変換可能な最大数はPHP_INT_MAX * 2 + 1 (또는 -1)です.
32ビットプラットフォームでは、10進数4294967295dechex()ffffffffを返します.
例1
echo dechex(10) . "\n";
echo dechex(47);
結果.
a
2f
例2
// The output below assumes a 32-bit platform.
// Note that the output is the same for all values.
echo dechex(-1)."\n";
echo dechex(PHP_INT_MAX * 2 + 1)."\n";
echo dechex(pow(2, 32) - 1)."\n";
結果.
ffffffff
ffffffff
ffffffff
リファレンス
https://phpman.ml/dechex
https://www.php.net/manual/en/function.dechex.php
Pythonコード
def dechex(number):
    return hex(number)
そうかんかんすう
hexdec
decbin
decoct
base_convert
copyright phpman all right reserved
インスタントレコーダ uses phpman 's content under contract.
インスタントレコーダで開発依頼を要求する場合は、FAQを参照してください.適切であれば、[email protected]に連絡してください.