Just use floatval() .
eg:.
$var = '122.34343'; $float_value_of_var = floatval($var); echo $float_value_of_var;
And if you are wondering doubleval() , this is just an alias for floatval() .
And, as others say, in a financial application, float values โโare crucial because they are not accurate enough. For example. adding two floats can lead to something like 12.30000000001 , and this error can propagate.
Felix Kling Mar 29 '10 at 17:53 2010-03-29 17:53
source share