note 25590 added to function.dechex

From: Date: Sun, 29 Sep 2002 18:55:11 +0000
Subject: note 25590 added to function.dechex
Groups: php.notes 
Request: Send a blank email to php-notes+get-37392@lists.php.net to get a copy of this message
<html> <head> <title>Long</title> </head> <body> <table width="100%" align="center" border="0"> <tr> <td width="100%" align="center"><p><a href="../../">Home</a></p> <table border="0"> <tr> <td> <blockquote>* long (64 bits) 0 - 18446744073709551615</blockquote> <blockquote><div id="data"> <? function dec2hex($number) { $length=16; $hexval=""; while ($number>0) { $remainder=bcmod($number,16); if ($remainder<10) $hexval=$remainder.$hexval; elseif ($remainder==10) $hexval="A".$hexval; elseif ($remainder==11) $hexval="B".$hexval; elseif ($remainder==12) $hexval="C".$hexval; elseif ($remainder==13) $hexval="D".$hexval; elseif ($remainder==14) $hexval="E".$hexval; elseif ($remainder==15) $hexval="F".$hexval; $number=bcdiv($number,16); } while (strlen($hexval)<$length) $hexval="0".$hexval; return $hexval; } $tmp = "<table width='643' border='1'>"; $x = 1; $y = 1; $z = dec2hex($x); $q = dec2hex($y); for ($i=1;$i<65;$i++){ $x= bcpow(2,($i-1)); $z = dec2hex($x); $tmp .="<tr><td width='20' align='center' bgcolor='#808080'><font color='#ffffff'>". $i; $tmp .="</font></td><td width='5'>2<sup>". ($i-1) . "</sup></td><td width='2'>=</td></td><td>" . $x . "</td>"; $tmp .="<td>".$z."</td><td>".$y."</td><td>".$q."</td></tr>"; $y = bcsub(bcpow(2,$i+1),1); $q = dec2hex($y); } $tmp .= "</table>"; echo $tmp; ?> </div></blockquote> </td> </tr> </table> </td> </tr> </table> </body> </html> -- http://www.php.net/manual/en/function.dechex.php http://master.php.net/manage/user-notes.php?action=edit+25590 http://master.php.net/manage/user-notes.php?action=delete+25590 http://master.php.net/manage/user-notes.php?action=reject+25590

« previous php.notes (#37392) next »