From: "Robert Cummings" <[EMAIL PROTECTED]>

> On Thu, 2003-09-25 at 16:28, Jeff McKeon wrote:
> > Correct me if I'm wrong please, but I think number_format() has the
> > adverse effect of changing the value type from numeric to char and
> > therefore baring you from using it in mathematical equation later in the
> > script.
> >
> > Anyway that's what it seemed to do to me when I used it on results from
> > a MySQL query...
>
> That shouldn't happen. PHP is a typeless language and so type
> conversions are juggled on the fly. If you pass a numerical string to a
> mathematical operator, then the string will be converted to the
> appropriate value.

If you get a result of "1,234.56" from number_format() and try to use that
as a numerical value (i.e. it's converted to an int or float), you'll end up
with the value being 1, though. Everything after the first non-numeric
character is lost. That's what he's talking about.

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to