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?
How to convert string into numbers
Moderator: General Moderators
Re: How to convert string into numbers
use (float) instead of (int)
Re: How to convert string into numbers
Thanks a lot.