Two notes:

1. 0 is not a credit or a debt. This is why you see zero balances at a
bank without a postfix.
2. Don't use floating point numbers to manage currency. They're they
lossy compression of numerics and you can end up with some unpleasant
surprises.

Regards,
Richard.

On 21 April 2010 16:29, Keri Henare <[email protected]> wrote:
> or:
>
> public function amountNice()
> {
>  return abs($this->GetAmount()) . ($this->GetAmount() < 0 ? 'DR' : 'CR');
> }
>
> Kind regards,
> Keri Henare
> ---------------------------------------------------
> [e]  [email protected]
> [w]  kerihenare.com
> [m]  (+64) 021 874 552
>
> PLEASE NOTE: I check my email 3 times per day and will respond at these 
> intervals.  For anything urgent please ring me.
> ---------------------------------------------------
>
> On 21/04/2010, at 4:23 PM, Aaron Cooper wrote:
>
>> For archives:
>>
>> public function amountNice() {
>>     if($this->GetAmount()< 0) {
>>       $suffix = 'DR';
>>     } else {
>>       $suffix = 'CR';
>>     }
>>
>>     $value = abs($this->GetAmount()) . $suffix;
>>     return $value;
>>   }
>>
>> --
>> NZ PHP Users Group: http://groups.google.com/group/nzphpug
>> To post, send email to [email protected]
>> To unsubscribe, send email to
>> [email protected]
>
> --
> NZ PHP Users Group: http://groups.google.com/group/nzphpug
> To post, send email to [email protected]
> To unsubscribe, send email to
> [email protected]

-- 
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]

Reply via email to