close

轉自 http://php.net/manual/en/function.bindec.php

--

bindec() - 二進位轉十進位

bindec

(PHP 4, PHP 5, PHP 7)

bindec — Binary to decimal

Description ¶

number bindec ( string $binary_string )

Returns the decimal equivalent of the binary number represented by the binary_string argument.

bindec() converts a binary number to an integer or, if needed for size reasons, float.

bindec() interprets all binary_string values as unsigned integers. This is because bindec() sees the most significant bit as another order of magnitude rather than as the sign bit.

Examples ¶

Example #1 bindec() example

<?php
echo bindec('110011') . "\n";
echo 
bindec('000110011') . "\n";

echo 
bindec('111');
?>

The above example will output:

51
51
7

--

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 dizzy03 的頭像
    dizzy03

    碎碎念

    dizzy03 發表在 痞客邦 留言(0) 人氣()