フォーラム@nifty | フォーラム・サークル | サイトマップ | ヘルプ |
掲示板 コラム お役立ち イベント リンク   | FHPGサイトマップ | お問い合わせ |
TOP > お役立ち > ASP de PHP > BinDec  

BinDec 関数

Scripting by かっしい (2004/02/11 登録)

 ASP with VBScript で PHP の便利な関数を定義してみる (5)

BinDec()

  2進数を10進数へ変換する関数。

関数の説明

 BinDec (strBin as String) as integer

 → PHPにおけるこの関数の説明を見る。

BinDec のソース

<%
Public Function BinDec(strBin)
  Dim intBinLen
  Dim intDec

  intDec = 0
  intBinLen = Len(trim(strBin))

  For i = 0 to intBinLen-1
    intDec = intDec + Mid(strBin,intBinLen-i,1) * 2^i
  Next

  BinDec = intDec

End Function
%>
ページのトップへ
個人情報保護ポリシー
Copyright© NIFTY 2006 All Rights Reserved.
Copyright© FHPG 2006 All Rights Reserved.