久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      php怎么將二進(jìn)制轉(zhuǎn)換為十進(jìn)制

      php將二進(jìn)制轉(zhuǎn)換為十進(jìn)制的方法:1、使用bindec()函數(shù),語(yǔ)法“bindec($binary_string)”;2、使用base_convert()函數(shù),語(yǔ)法“base_convert($binary_string,2,10)”。

      php怎么將二進(jìn)制轉(zhuǎn)換為十進(jìn)制

      本教程操作環(huán)境:windows7系統(tǒng)、PHP7.1版、DELL G3電腦

      php將二進(jìn)制轉(zhuǎn)換為十進(jìn)制

      1、使用bindec()函數(shù)

      bindec($binary_string) 函數(shù)把二進(jìn)制數(shù)$binary_string轉(zhuǎn)換為十進(jìn)制數(shù)。

      <?php echo bindec("0011") . "<br>"; echo bindec("01") . "<br>"; echo bindec("11000110011") . "<br>"; echo bindec("111"); ?>

      輸出結(jié)果:

      php怎么將二進(jìn)制轉(zhuǎn)換為十進(jìn)制

      2、使用base_convert()函數(shù)

      base_convert() 函數(shù)在任意進(jìn)制之間轉(zhuǎn)換數(shù)字。

      base_convert($binary_string,$frombase,$tobase);
      • $binary_string 必需。規(guī)定要轉(zhuǎn)換的二進(jìn)制數(shù)。

      • $frombase 必需。規(guī)定數(shù)字原來的進(jìn)制。介于 2 和 36 之間(包括 2 和 36)。高于十進(jìn)制的數(shù)字用字母 a-z 表示,例如 a 表示 10,b 表示 11 以及 z 表示 35。

      • $tobase 必需。規(guī)定要轉(zhuǎn)換的進(jìn)制。介于 2 和 36 之間(包括 2 和 36)。高于十進(jìn)制的數(shù)字用字母 a-z 表示,例如 a 表示 10,b 表示 11 以及 z 表示 35。

      <?php header("content-type:text/html;charset=utf-8"); $num1="0011"; $num2="11000110011"; echo "二進(jìn)制 ".$num1." 轉(zhuǎn)換成十六進(jìn)制 ".base_convert($num1,2,10)."<br>";  echo "二進(jìn)制 ".$num2." 轉(zhuǎn)換成十六進(jìn)制 ".base_convert($num2,2,10)."<br>";  ?>

      輸出結(jié)果:

      php怎么將二進(jìn)制轉(zhuǎn)換為十進(jìn)制

      推薦學(xué)習(xí):《PHP視頻教程》

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)