This document can't see how the amount here is converted, I tried to convert from decimal to hexadecimal Web3.towei method I haven't seen the same effect. Please ask someone to answer it.
,0x9184e72a is indeed hexadecimal, but the unit is Wei, 1 eth = 10 ^ 18 Wei, and 1 eth is equal to the 18th power of 10. You can convert it into eth to verify it.
,The denomination unit of ether is three zeros in one file. Recommend an Ethereum DAPP development tutorial for novices:Introduction to Ethereum DAPP development
0x9184e72a is indeed hexadecimal, but the unit is Wei, 1 eth = 10 ^ 18 Wei, and 1 eth is equal to the 18th power of 10. You can convert it into eth to verify it.
It has been tested to convert to Wei unit first, and then to hexadecimal. However, the result of this method is that the result is too large for PHP to display. The result is 07fff right
I’m not sure what you want to do. The comments on that line have told you that 0x9184e72a is converted into decimal system 24414062502441406250, and the 18th power of division by 10 is the value corresponding to eth.
Oh, thank you for your answer. I’ll test it again
Still there? My question is how to convert eth units to 0x9184e72a such a formatFor example, how can 0.01 eth be converted to this format (hexadecimal) -?1 eth = 10 ^ 18 Wei, then this parameter is not hexadecimal
0.01 ETH = 10^16 wei, hex(10^16) = 0x2386f26fc10000
2386f26fc to hexadecimal is not equal to 10000
The 2386f26fc10000 is completely connected. You can change it by yourself. In order to answer the questions, I have used Python conversion. Don’t be so lazy.
I converted it. The binary conversion result of PHP is wrong
It has been tested with PHP and the results are the same.
$a = pow(10, 16);
echo base_convert($a, 10, 16);
What is your PHP version? My 5.5.38 run, the code above is 3F8
I don’t write PHPhttp://www.dooccn.com/php/
Try, my code can be found on your website. Not locally<?php
$a = pow(10,16);
$b = pow(10, 16);
echo base_convert($b, 10, 16);
You can go deep into the specific reasons. I won’t go deep into it. After all, I don’t write PHP.
thank. Read a posthttps://segmentfault.com/q/10…Prevent conversion to scientific counting first $num = number_ format($num, 0, ”, ”);Reuse base_ convert($num, 10, 16);To convert