note 35383 added to function.hexdec
| From: | gelado at ip3 dot com | Date: | Fri, 29 Aug 2003 09:30:48 +0000 |
| Subject: | note 35383 added to function.hexdec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-55283@lists.php.net to get a copy of this message | ||
Another hex to decimal converter, up to the precision of PHP floats.
function longhex($hex)
{
$dec = 0;
$bitval = 1;
for($pos = 1; $pos <= strlen($hex); $pos++) {
$dec += hexdec(substr($hex, -$pos, 1)) * $bitval;
$bitval *= 16;
}
return($dec);
}
----
Manual Page -- http://www.php.net/manual/en/function.hexdec.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35383
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35383&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35383&report=yes