Re: [PHP] Field type for american money

[email protected] (Waynn Lue)
Newsgroups php.general
Message-ID <[email protected]>
>
> Shawn McKenzie wrote:
>
>> Waynn Lue wrote:
>>
>>> For mysql, it's better to use int and then store it in cents (or
>>> micros) so you can use all integer operations instead of float ones.
>>>
>>>
>> To each his own.  Speed or otherwise I don't see a difference between:
>>
>> $total = 19.95 + 3.99; //shipping
>>
>> and
>>
>> $total = 1995 + 399; //shipping
>>
>> Except with the ints you have to format them for display.
>>
>
> You have to format the floats too:
>
> <?php
>
>    $total = 5.55 + 9.35;
>    echo $total."\n";
>
> ?>
>

Oh, I didn't mean speed within PHP, I meant for mysql operations.  I'm not
sure how PHP handles int vs. float operations (though int is usually faster
than float for other languages, isn't it?).
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.