Re: [PHP] 2 decimal places

2001-09-25 Thread Jason Bell
What if I want to pad a number with zeros in the other direction? I.E: 524 becomes 00524 - Original Message - From: Christian Dechery [EMAIL PROTECTED] To: Kurth Bemis [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, September 25, 2001 9:41 AM Subject: Re: [PHP] 2 decimal

RE: [PHP] 2 decimal places

2001-09-25 Thread Boget, Chris
What if I want to pad a number with zeros in the other direction? I.E: 524 becomes 00524 printf() / sprintf() is your friend. Chris

Re: [PHP] 2 decimal places

2001-09-25 Thread Evan Nemerson
Yeah, but what if they don't JUST want to print it... /*untested*/ $i=524; $n=5-strlen($i); $outnum=; for($x=1;$x=$n;$x++){ $outnum.=0; }; $outnum.=$i; On Tuesday 25 September 2001 09:56, you wrote: What if I want to pad a number with zeros in the other direction? I.E: 524

RE: [PHP] 2 decimal places

2001-09-25 Thread Boget, Chris
Yeah, but what if they don't JUST want to print it... Umm, have you read the documentation on either of the functions? They both return a string; they don't send anything to standard out (like echo or print does). $myString = printf(); $myString = sprintf(); echo $myString; Chris

Re: [PHP] 2 decimal places

2001-09-25 Thread Meir Kriheli
(there are good examples about formatting in sprintf()'s documentation). -- Meir Kriheli - Original Message - From: Christian Dechery [EMAIL PROTECTED] To: Kurth Bemis [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, September 25, 2001 9:41 AM Subject: Re: [PHP] 2 decimal places

Re: [PHP] 2 decimal places

2001-09-25 Thread Meir Kriheli
On Tuesday 25 September 2001 19:38, Evan Nemerson wrote: Yeah, but what if they don't JUST want to print it... /*untested*/ $i=524; $n=5-strlen($i); $outnum=; for($x=1;$x=$n;$x++){ $outnum.=0; }; $outnum.=$i; $outnum = sprintf('%05d' , 524); -- Meir Kriheli On Tuesday 25

[PHP] 2 decimal places

2001-09-19 Thread Kurth Bemis
i'm looking for a php function to add 2 decimal place sto a number. if the number already have one decimal place then one more zero should be added to make it two decimal placesanyone know of a quick way to do this? ~kurth -- PHP General Mailing List (http://www.php.net/) To

RE: [PHP] 2 decimal places

2001-09-19 Thread Kurth Bemis
At 10:24 PM 9/19/2001, Jack Dempsey wrote: Thank You! look into printf and number_format -Original Message- From: Kurth Bemis [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 19, 2001 10:23 PM To: [EMAIL PROTECTED] Subject: [PHP] 2 decimal places i'm looking for a php function

Re: [PHP] 2 decimal places

2001-09-19 Thread nate
number_format($variable, 2, '.', '') something like that i believe - Original Message - From: Kurth Bemis [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 19, 2001 7:22 PM Subject: [PHP] 2 decimal places i'm looking for a php function to add 2 decimal place sto