Skip to content

Commit f29b7bc

Browse files
authored
Add files via upload
1 parent d96d11a commit f29b7bc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Tools.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ public function hex2address(string $address) : string {
2323
}
2424
public function dec2hex(string $dec,int $base = 16) : string {
2525
if(extension_loaded('bcmath')):
26-
if(bccomp($dec,0) == 0) return strval(0);
26+
if(bccomp($dec,strval(0)) == 0) return strval(0);
2727
$hex = strval(null);
28-
while(bccomp($dec,0) > 0):
29-
$mod = bcmod($dec,$base);
28+
while(bccomp($dec,strval(0)) > 0):
29+
$mod = bcmod($dec,strval($base));
3030
$hex = dechex(intval($mod)).$hex;
31-
$dec = bcdiv($dec,$base,0);
31+
$dec = bcdiv($dec,strval($base),0);
3232
endwhile;
3333
return $hex;
3434
else:
@@ -42,7 +42,7 @@ public function hex2dec(string $hex,int $base = 16) : string {
4242
$len = strlen($hex);
4343
for($i = 0; $i < $len; $i++):
4444
$current = hexdec($hex[$i]);
45-
$dec = bcmul($dec,$base);
45+
$dec = bcmul($dec,strval($base));
4646
$dec = bcadd($dec,strval($current));
4747
endfor;
4848
return $dec;

0 commit comments

Comments
 (0)