Welcome to the Cookbook

loading...

7.6.1 currency

Todavia no hay una traducion de este texto. Por favor ayudanos y traducirla.. Mas info sobre traduciones

currency(mixed $number, string $currency= 'USD')

This method is used to display a number in common currency formats (EUR,GBP,USD). Usage in a view looks like:

<?php echo $number->currency($number,$currency); ?>
  1. <?php echo $number->currency($number,$currency); ?>

The first parameter, $number, should be a floating point number that represents the amount of money you are expressing. The second parameter is used to choose a predefined currency formatting scheme:

$currency 1234.56, formatted by currency type
EUR € 1.236,33
GBP £ 1,236.33
USD $ 1,236.33

HTML entities are outputted as currency symbols where needed.

If a non-recognized $currency value is supplied, it is prepended to a USD formatted number. For example:

<?php echo $number->currency('1234.56', 'FOO'); ?>
 
//Outputs: 
FOO 1,234.56
  1. <?php echo $number->currency('1234.56', 'FOO'); ?>
  2. //Outputs:
  3. FOO 1,234.56