I am having few values 99.00 99.90 99.01
FYI, I am already getting the above 3 values after having number_format($value, 2) applied to them
But now I want to strip the decimals without rounding them off such as 99.00 to 99 99.90 to 99.9 99.01 to 99.01 remains same
How can achieve this? Please devise me a way guys.
I just need a function which checks following:
- Whether a given number is decimal i.e having "." and digits after decimal
- Whether the last digit is 0, if yes, then get rid of the last digit
- Whether both the digits after decimal points are 0, if yes, remove them.
- If any of them are not 0, then they should remain there, like in case of 99.09 it should remain intact, in case of 99.90 it should be 99.9.
Awaiting your ideas. Thanks in advance.