note 19499 added to function.bindec
| From: | php at silisoftware dot com | Date: | Fri, 01 Mar 2002 00:16:48 +0000 |
| Subject: | note 19499 added to function.bindec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-27210@lists.php.net to get a copy of this message | ||
For converting larger-than-31-bit numbers:
function Bin2Dec($binstring) {
for ($i=0;$i<strlen($binstring);$i++) {
$decvalue += ((int) substr($binstring, strlen($binstring) - $i - 1, 1)) * pow(2, $i);
}
return $decvalue;
}
--
http://www.php.net/manual/en/function.bindec.php
http://master.php.net/manage/user-notes.php?action=edit+19499
http://master.php.net/manage/user-notes.php?action=delete+19499
http://master.php.net/manage/user-notes.php?action=reject+19499