I have a number 3.43E-6 and I need to convert it into 0.00000343. Is that possible with PHP?
I tried PHP number_format and also tried using the answer of this post (float), but it does not work as expected. The mentioned number is not a string but a decimal value, and by the answer mentioned in that post we can get the normal whole number from positive exponential values (5.78e5, 3.14e5), but not working for the negative exponential values like 3.43E-6, 6.24464e-7, 5.864e-5. It returns the same value that we give as an input if we use a negative exponential value.
Number: 3.43E-6
Expected result: 0.00000343
2
Answers
Using the answers provided, I created a function like the one below, which seems to be working fine.
This function can convert the exponential values to a whole number (in decimal notation).
The above code gives a result of 0.000000620503.
I don't know if this is the proper solution or not; however, it is working correctly.
Thank you all!
yes it is possible try this and you can modify this 8 if u want more decimal
'%.8f
also this is another example
there is other way of doing this :