Re: FN-FORUM: PHP Float
date posted 5th August 2003 18:08
> > Hi All,
> > Last questions for the day. I've got a string that say could be 123.4
or
> > 123.323. How would I get it to 123.00. I've got the number in a variable
> > which I then went to put into another varible (this case a session
> > handeler)
Or, if it was the 123.00 you wanted (ie. with trailing zeroes), you might
want to take a look at number_format.
Something like
echo(number_format(123.323,2,'.',''));
might do the job
123.323 is your number
2 is the number of decimal places
'.' is the decimal seperator
',' is the thousands seperator (eg. ",")
hth
dan.