Functions:dollarFormat

From Whirlwind eCommerce Wiki
Jump to: navigation, search
Page Template Managers

Page Template Functions

Description

Converts a decimal to dollar output including preceding $ sign.

Syntax

$stringDollarAmount = eV::dollarFormat($decimalAmount,$forceCents);

Paramaters

  • $decimalAmount DECIMAL
decimal amount to be converted to dollar value
  • $forceCents BOOL Optional
dictates if the dollar value returned should always be extended out 2 decimal places. Defaults to true.

Return Values

Returns a string dollar version of the provide decimal amount.


Examples

echo eV::dollarFormat(126.5);
// outputs $126.50
 
echo eV::dollarFormat(126);
// outputs $126.00
 
echo eV::dollarFormat(126,false);
// outputs $126

History

10/30/2008 Mark W. : Added forceCents attribute.