I am developing a non profit project that uses a lot of forks (and bitcoin of course) - but's i can't decide what datatype use to store prices.
There are several ways to do this, but i have chosen two of them - to use BIGINTEGER, and store it as a STRING
1) - BIGINTEGER (in this case i keep pennie e.g. Satoshi) it's better to use in calculations - but i can't wrap my head around - how to properly take user input? What datatype should i use to use math operations in PHP, and what additional data i need to keep to convert on currency to another (i mean there are possibility that some forks can use more digits after point.)
2) STRING - just impossible to make any computations, before proper conversion. But it's much simper to keep - i mean you just can store the raw user's input
Can somebody share some ideas with me about this matter?
An inneficient way of doing this is by you just using strings for everything. There is only addition and subtraction that is required in this I presume, so you can easily just encorporate math in that way.
Alternatively, you could try to use "Double" variable types or "Float" if php doesn't provide "double"s (doubles is with a desimal but is 64 bit floating point instead of 32 bit.
I assum BIGINTEGER represents INT64, but you could as well just use regular integers as they should be 2
32 and you probably don't need much higher than that.