Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can we convert exponential or scientific notation number to a whole number?

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 but not worked as expected.

Number:- 3.43E-6
Expected result:- 0.00000343

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

yes it is possible try this and you can modify this 8 if u want more decimal '%.8f

$number = 3.43E-6;
$decimal = sprintf('%.8f', $number);
echo '$' . $decimal; // output: $0.00000343

also this is another example

$decimal = sprintf('%.10f', $number);
echo '$' . $decimal; // output: $0.0000034300
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading