note 99130 added to ref.bc

From: Date: Thu, 29 Jul 2010 13:18:30 +0000
Subject: note 99130 added to ref.bc
Groups: php.notes 
Request: Send a blank email to php-notes+get-171204@lists.php.net to get a copy of this message
Here are some useful functions to convert large hex numbers from and to large decimal ones : <?php public static function bchexdec($hex) { if(strlen($hex) == 1) { return hexdec($hex); } else { $remain = substr($hex, 0, -1); $last = substr($hex, -1); return bcadd(bcmul(16, bchexdec($remain)), hexdec($last)); } } public static function bcdechex($dec) { $last = bcmod($dec, 16); $remain = bcdiv(bcsub($dec, $last), 16); if($remain == 0) { return dechex($last); } else { return bcdechex($remain).dechex($last); } } ---- Server IP: 195.221.21.36 Probable Submitter: 82.120.51.45 ---- Manual Page -- http://www.php.net/manual/en/ref.bc.php Edit -- https://master.php.net/note/edit/99130 Del: integrated -- https://master.php.net/note/delete/99130/integrated Del: useless -- https://master.php.net/note/delete/99130/useless Del: bad code -- https://master.php.net/note/delete/99130/bad+code Del: spam -- https://master.php.net/note/delete/99130/spam Del: non-english -- https://master.php.net/note/delete/99130/non-english Del: in docs -- https://master.php.net/note/delete/99130/in+docs Del: other reasons-- https://master.php.net/note/delete/99130 Reject -- https://master.php.net/note/reject/99130 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#171204) next »