cakephp-1.3 > NumberHelper :: currency()
Search Method

NumberHelper

A AclBase AclBehavior AclComponent AclNode AclShell Aco AcoAction AjaxHelper ApcEngine ApiShell App AppController AppController AppHelper AppHelper AppModel AppModel Aro AuthComponent B BakeShell BakeTask BehaviorCollection C Cache CacheEngine CacheHelper CakeErrorController CakeLog CakeRoute CakeSchema CakeSession CakeSocket ClassRegistry Component Configure ConnectionManager ConsoleShell ContainableBehavior Controller ControllerTask CookieComponent D DataSource DbAcl DbAclSchema DbConfigTask DboMssql DboMysql DboMysqlBase DboMysqli DboOracle DboPostgres DboSource DboSqlite Debugger Dispatcher E EmailComponent ErrorHandler ErrorHandler ExtractTask F File FileEngine FileLog FixtureTask Folder FormHelper H Helper HtmlHelper HttpSocket I I18n I18nModel i18nSchema I18nShell Inflector IniAcl J JavascriptHelper JqueryEngineHelper JsBaseEngineHelper JsHelper L L10n M MagicDb MagicFileResource MediaView MemcacheEngine Model ModelBehavior ModelTask MootoolsEngineHelper Multibyte N NumberHelper O Object Overloadable Overloadable Overloadable2 Overloadable2 P PagesController PagesController PaginatorHelper Permission PluginShortRoute PluginTask ProjectTask PrototypeEngineHelper R RequestHandlerComponent Router RssHelper S Sanitize Scaffold ScaffoldView SchemaShell Security SecurityComponent SessionComponent SessionHelper SessionsSchema Set Shell ShellDispatcher String T TemplateTask TestSuiteShell TestTask TextHelper ThemeView TimeHelper TranslateBehavior TreeBehavior V Validation View ViewTask X XcacheEngine Xml XmlElement XmlHelper XmlManager XmlNode XmlTextNode

currency

line:184 at /cake/libs/view/helpers/number.php
Formats a number into a currency format.

Method

(string) currency ($number, $currency = 'USD', $options = array())

Parameters

ParameterTypeCommentDefault
$number float required
$currency string optional Shortcut to default options. Valid values are 'USD', 'EUR', 'GBP', otherwise set at least 'before' and 'after' options. 'USD'
$options array optional array()

Return

string

Comment

Formats a number into a currency format.

### Options

- `before` - The currency symbol to place before whole numbers ie. '$'
- `after` - The currency symbol to place after decimal numbers ie. 'c'. Set to boolean false to
use no decimal symbol. eg. 0.35 => $0.35.
- `zero` - The text to use for zero values, can be a string or a number. ie. 0, 'Free!'
- `places` - Number of decimal places to use. ie. 2
- `thousands` - Thousands separator ie. ','
- `decimals` - Decimal separator symbol ie. '.'
- `negative` - Symbol for negative numbers. If equal to '()', the number will be wrapped with ( and )
- `escape` - Should the output be htmlentity escaped? Defaults to true

@param float $number
@param string $currency Shortcut to default options. Valid values are 'USD', 'EUR', 'GBP', otherwise
set at least 'before' and 'after' options.
@param array $options
@return string Number formatted as a currency.
@access public
@link http://book.cakephp.org/view/1453/currency