How to convert a string containing a number in scientific notation to float in PHP

2 Answers

0 votes
$e = '9.821e-05';

$f = (float)$e;

echo $f;



  
/*
run:
       
9.821E-5
      
*/

 



answered Mar 20, 2019 by avibootz
0 votes
$e = '9.821e-005';

$f = $e + 1;

echo $f;


  
/*
run:
       
1.00009821
      
*/

 



answered Mar 21, 2019 by avibootz

Related questions

...