Re: Fixe Point Decimal Data type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I may be over-simplifying or not completely understanding fixed point decimals, but would number_format work?

Take care,
Floyd

On Dec 17, 2009, at 9:21 AM, Raymond Irving wrote:

> Hello,
> 
> Is there a way to represent numeric values as fixed point decimals in PHP? If not, why was this datatype not added?
> 
> I think is very important to have fixed point decimals when working with money values. This would make it much easy than having to use the BCMath functions. 
> 
> If PHP had support for operator overloading then we could have easily implemented this datatype as a class:
> 
> $a = new FixPoint(34.56, 2);
> $b = new FixPoint(34.55, 2);
> 
> $c = $a-$b;
> echo ($c);
> 
> $c+= 3;
> echo $c;


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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux