| ユーザフォーラムで議論/質問 | マニュアル検索 | ハイライト | ハイライトオフ | ポータル | php spot |
bindec(PHP 4, PHP 5, PHP 7) bindec — 2 進数 を 10 進数に変換する 説明
引数 bindec() は、2 進数を integer に変換します。 サイズの問題により、必要に応じて float となることもあります。
bindec() は、すべての
パラメータ
警告
このパラメータは文字列でなければなりません。 他のデータ型を使用すると、予期せぬ結果となります。 返り値
例
例1 bindec() の例
<?php 上の例の出力は以下となります。 51 51 7
例2 bindec() が入力を符号なし整数として処理する例
<?php 上の例の 32 ビットマシンでの出力は、このようになります。 input: 1073741823 binary: 00111111111111111111111111111111 bindec(): 1073741823 input: 1073741824 binary: 01000000000000000000000000000000 bindec(): 1073741824 NOTE: See the rollover? Watch it next time around... input: 2147483647 binary: 01111111111111111111111111111111 bindec(): 2147483647 NOTE: PHP_INT_MAX input: -2147483648 binary: 10000000000000000000000000000000 bindec(): 2147483648 NOTE: interpreted to be one more than PHP_INT_MAX input: -1 binary: 11111111111111111111111111111111 bindec(): 4294967295 NOTE: interpreted to be the largest unsigned integer 上の例の 64 ビットマシンでの出力は、このようになります。 input: 4611686018427387903 binary: 0011111111111111111111111111111111111111111111111111111111111111 bindec(): 4611686018427387903 input: 4611686018427387904 binary: 0100000000000000000000000000000000000000000000000000000000000000 bindec(): 4611686018427387904 NOTE: See the rollover? Watch it next time around... input: 9223372036854775807 binary: 0111111111111111111111111111111111111111111111111111111111111111 bindec(): 9223372036854775807 NOTE: PHP_INT_MAX input: -9223372036854775808 binary: 1000000000000000000000000000000000000000000000000000000000000000 bindec(): 9223372036854775808 NOTE: interpreted to be one more than PHP_INT_MAX input: -1 binary: 1111111111111111111111111111111111111111111111111111111111111111 bindec(): 18446744073709551616 NOTE: interpreted to be the largest unsigned integer (18446744073709551615) but skewed by float precision 参考
|
![]() |
各種マニュアル:
PHPマニュアル |
PEARマニュアル |
Smarty(英語)マニュアル |
PHP-GTKマニュアル |
「bindec - 2 進数 を 10 進数に変換する」をGoogle検索
|