We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d96d11a commit f29b7bcCopy full SHA for f29b7bc
src/Tools.php
@@ -23,12 +23,12 @@ public function hex2address(string $address) : string {
23
}
24
public function dec2hex(string $dec,int $base = 16) : string {
25
if(extension_loaded('bcmath')):
26
- if(bccomp($dec,0) == 0) return strval(0);
+ if(bccomp($dec,strval(0)) == 0) return strval(0);
27
$hex = strval(null);
28
- while(bccomp($dec,0) > 0):
29
- $mod = bcmod($dec,$base);
+ while(bccomp($dec,strval(0)) > 0):
+ $mod = bcmod($dec,strval($base));
30
$hex = dechex(intval($mod)).$hex;
31
- $dec = bcdiv($dec,$base,0);
+ $dec = bcdiv($dec,strval($base),0);
32
endwhile;
33
return $hex;
34
else:
@@ -42,7 +42,7 @@ public function hex2dec(string $hex,int $base = 16) : string {
42
$len = strlen($hex);
43
for($i = 0; $i < $len; $i++):
44
$current = hexdec($hex[$i]);
45
- $dec = bcmul($dec,$base);
+ $dec = bcmul($dec,strval($base));
46
$dec = bcadd($dec,strval($current));
47
endfor;
48
return $dec;
0 commit comments