need a float with 2 decimal places
Posted: Thu Aug 04, 2005 12:30 pm
Hey there
i have a variable and i need to make it a float to display later.
i cant use printf() because the value will display text if there is no numeric value
i also cant just set it to a float because i need to have it go to 2 decimal places.
so if $var = 12.3 i will get 12.30
like with money, i dont have .3 dollars, i have 30 cents.
this isnt a money project but the same would apply
lots of docs out there on type conversions, but i couldn't find out how to do this
thanks
i have a variable and i need to make it a float to display later.
i cant use printf() because the value will display text if there is no numeric value
i also cant just set it to a float because i need to have it go to 2 decimal places.
so if $var = 12.3 i will get 12.30
like with money, i dont have .3 dollars, i have 30 cents.
this isnt a money project but the same would apply
lots of docs out there on type conversions, but i couldn't find out how to do this
thanks