Re: [PHP] How do I get the result of a Division to 2 decimal places?

2003-09-09 Thread Raditha Dissanayake
printf(%.2f,$number); Shaun wrote: Hi, I am dividing a number by another number and printing the result to the screen. How can I ensure that the number is rounded up to 2 decimal places? Thanks for your help -- http://www.radinks.com/upload Drag and Drop File Uploader. -- PHP General

Re: [PHP] How do I get the result of a Division to 2 decimal places?

2003-09-09 Thread Marco Schuler
Hi Am Die, 2003-09-09 um 16.06 schrieb Shaun: Hi, I am dividing a number by another number and printing the result to the screen. How can I ensure that the number is rounded up to 2 decimal places? Use printf with format strings like printf(Value: %.2f, $value);

RE: [PHP] How do I get the result of a Division to 2 decimal places?

2003-09-09 Thread Jay Blanchard
[snip] I am dividing a number by another number and printing the result to the screen. How can I ensure that the number is rounded up to 2 decimal places? [/snip] Why others never test these things I'll never know...but here is a small test you can run ?php /* ** rounding / number format

Re: [PHP] How do I get the result of a Division to 2 decimal places?

2003-09-09 Thread Marek Kilimajer
It is not mentioned in the manual, but it seems dec_point cannot be empty. If it is empty, default (.) is taken. Jay Blanchard wrote: [snip] I am dividing a number by another number and printing the result to the screen. How can I ensure that the number is rounded up to 2 decimal places? [/snip]

RE: [PHP] How do I get the result of a Division to 2 decimal places?

2003-09-09 Thread Jay Blanchard
[snip] It is not mentioned in the manual, but it seems dec_point cannot be empty. If it is empty, default (.) is taken. echo number_format($number, 4, '', ',').\n; number_format() does allow an empty set of single quotes in the third attribute which it will default to a period (.) for the

Re: [PHP] How do I get the result of a Division to 2 decimal places?

2003-09-09 Thread Marek Kilimajer
I meant you cannot set decimal point to be '', it will always display. Yes you can supply '' for the third argument. Jay Blanchard wrote: [snip] It is not mentioned in the manual, but it seems dec_point cannot be empty. If it is empty, default (.) is taken. echo number_format($number, 4,

RE: [PHP] How do I get the result of a Division to 2 decimal places?

2003-09-09 Thread Jay Blanchard
[snip] I meant you cannot set decimal point to be '', it will always display. Yes you can supply '' for the third argument. [/snip] Ah! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php