note 97293 added to function.hexdec

From: Date: Mon, 12 Apr 2010 21:44:13 +0000
Subject: note 97293 added to function.hexdec
Groups: php.notes 
Request: Send a blank email to php-notes+get-168178@lists.php.net to get a copy of this message
Here's a considerably faster version of bchexdec, which converts numbers of arbitrary precision. It's about 40% quicker than the other version on this page: <?php function bchexdec($hex) { static $hexdec = array('0','1','2','3','4','5','6','7','8','9', 'a'=>'10','b'=>'11','c'=>'12','d'=>'13','e'=>'14','f'=>'15', 'A'=>'10','B'=>'11','B'=>'12','D'=>'13','E'=>'14','F'=>'15'); $dec = '0'; for ($i = $l = strlen($hex), $e = '1'; $i; $i--, $e = bcmul($e, '16')) $dec = bcadd($dec, bcmul($hexdec[$hex[$i-1]], $e)); return $dec; } ?> ---- Server IP: 192.41.40.227 Probable Submitter: 70.135.68.190 ---- Manual Page -- http://www.php.net/manual/en/function.hexdec.php Edit -- https://master.php.net/note/edit/97293 Del: integrated -- https://master.php.net/note/delete/97293/integrated Del: useless -- https://master.php.net/note/delete/97293/useless Del: bad code -- https://master.php.net/note/delete/97293/bad+code Del: spam -- https://master.php.net/note/delete/97293/spam Del: non-english -- https://master.php.net/note/delete/97293/non-english Del: in docs -- https://master.php.net/note/delete/97293/in+docs Del: other reasons-- https://master.php.net/note/delete/97293 Reject -- https://master.php.net/note/reject/97293 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#168178) next »