Closed jerry89899 closed 7 years ago
The result you got are euro cents. (we don't really like floats :) )
so this will fix your problem:
$amount = 29164;
$euro = $amount / 100;
As far I can see the code they use now the Money object. https://github.com/moneyphp/money http://sandbox.onlinephpfunctions.com/code/190fa1893b934f6cd0e25072ea520d662b078660
Indeed the return value of balance()
is a Money object, which in serialized form looks like the JSON you pasted.
With floating point values, you lose precision, while the Money object is designed to avoid just that.
Indeed you can devide by 100 and cast to a float if you like, but since you can chain calls and do calculations with them, I prefer to use the Money object for this.
But thanks for the feedback here :) is your problem solved now?
I have closed the issue, if you have any questions further, feel free to open a new issue. Thanks for your question!
Here it shows that the amount of money i have is 29164 which i sadly dont have i only have 291,64. is there an way to let it show an float?
Here is the noob code i used. haha