April 19th, 2000, 01:08 PM
There was a posting earlier to print from 9.7589 to 9.76 - but I need something which can make $cost from 9.7589 to 9.76
I have searched the PHP site to see which command to use but had no luck.
April 20th, 2000, 02:15 AM
look up number_format(), that's probably what you need.
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Linux, the operating system with a clue - Command Line User Environment.[/quote]
April 21st, 2000, 02:22 PM
Well, to print the variable is easy enough... just use printf(). As for setting
the variable, you might try this:
$cost = 9.7586;
$newcost = (float) sprintf("%0.2f",$cost);
$newcost will be equal to 9.76.
(I tried this locally and it seemed to work alright, send me an e-mail if you have any problems getting it to work.)
[This message has been edited by cka (edited April 21, 2000).]