At 11:22 9/5/2001 -0700, Gerry wrote:
>Could you suggest a function for displaying decimal zeros.
>
>For example I have this:
>$num = "2.00";
>$num2 = "3.00";
>$result = $num + $num2;
>echo "$result";
>
>I get "5" but not "5.00"
try $result = (float)$num + (float)$num2;
--
PHP General Mailing
Use number_format() function.
See http://www.php.net/manual/en/function.number-format.php for detail.
Reuben D. B
At 11:22 AM 5/9/01 -0700, Gerry wrote:
>Could you suggest a function for displaying decimal zeros.
>
>For example I have this:
>$num = "2.00";
>$num2 = "3.00";
>$result = $num + $nu
ut.
- Original Message -
From: "Jennifer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 2001. május 4. 07:39
Subject: Re: [PHP] Working with numbers
>
>
> Christian Reiniger wrote:
> >
> > On Thursday 03 May 2001 08:53, Jennifer wrote:
> >
At 01:39 04.05.01 -0400, you wrote:
Ok Jennifer lets do some "basics" ;-)
>I've done some searching on the php site for more info about
>double and float etc, but I don't really understand anything I
>found. Can someone give me an explanation about the difference
>between decimal, float, double?
Christian Reiniger wrote:
>
> On Thursday 03 May 2001 08:53, Jennifer wrote:
>
> > I have a shopping cart that allows decimal points for quantities.
> > I like it like that, but would like to remove any trailing zeros
> > and if the quantity is not a fraction I would like to remove the
> > dec
what about function round() with precision argument ?
check it:
for ($i = 0; $i < 10; $i += 0.25) {
echo round($i,2). "";
}
- Original Message -
From: "Jennifer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 2001. május 3. 08:53
Subject: [PHP] Working with numbers
> I have a s
On Thursday 03 May 2001 08:53, Jennifer wrote:
> I have a shopping cart that allows decimal points for quantities.
> I like it like that, but would like to remove any trailing zeros
> and if the quantity is not a fraction I would like to remove the
> decimal point too.
>
> What would be the easie
7 matches
Mail list logo