Oct 2, 2002 #1 adam0101 Programmer Jun 25, 2002 1,952 US How can I get the following numbers: 2 2.3 2.45 2.456 To appear as: 2.00 2.30 2.45 2.46 If I try to use "round(num,2)", the output is incorrect: 2 2.3 2.45 2.46 Thanks
How can I get the following numbers: 2 2.3 2.45 2.456 To appear as: 2.00 2.30 2.45 2.46 If I try to use "round(num,2)", the output is incorrect: 2 2.3 2.45 2.46 Thanks
Oct 2, 2002 #2 danielhozac Programmer Aug 21, 2001 2,058 SE printf or sprintf should work. Code: printf("%.2f", $val); $string = sprintf("%.2f", $val); //Daniel Upvote 0 Downvote
printf or sprintf should work. Code: printf("%.2f", $val); $string = sprintf("%.2f", $val); //Daniel
Oct 2, 2002 Thread starter #3 adam0101 Programmer Jun 25, 2002 1,952 US Thank you, After posting this, I searched the forum and found out about the number_format() function as well. Next time I'll search the forum first. Upvote 0 Downvote
Thank you, After posting this, I searched the forum and found out about the number_format() function as well. Next time I'll search the forum first.