How to convert string into numbers
Posted: Thu Jul 29, 2010 11:10 am
Hi there
I want to convert a string into number which I got from scrapping. But problem is if the string contains decimal point it is automatically converted as round number.
$str = <? echo "10.42" ?>;
<? echo (int)$str; ?>
but the output is 10.
How to convert is as 10.42 instead 10 by a single line of code?
I want to convert a string into number which I got from scrapping. But problem is if the string contains decimal point it is automatically converted as round number.
$str = <? echo "10.42" ?>;
<? echo (int)$str; ?>
but the output is 10.
How to convert is as 10.42 instead 10 by a single line of code?