@@ -27,7 +27,7 @@ Available Functions
27
27
28
28
The following functions are available:
29
29
30
- .. php :function :: number_to_size($num[, $precision = 1[, $locale = null])
30
+ .. php :function :: number_to_size($num[, $precision = 1[, $locale = null]] )
31
31
32
32
:param mixed $num: Number of bytes
33
33
:param int $precision: Floating point precision
@@ -86,21 +86,23 @@ The following functions are available:
86
86
87
87
echo number_to_amount('123,456,789,012', 2, 'de_DE'); // Returns 123,46 billion
88
88
89
- .. php :function :: number_to_currency($num, $currency[, $locale = null])
89
+ .. php :function :: number_to_currency($num, $currency[, $locale = null[, $fraction = 0] ])
90
90
91
- :param mixed $num: Number to format
91
+ :param float $num: Number to format
92
92
:param string $currency: The currency type, i.e., USD, EUR, etc
93
- :param string $locale: The locale to use for formatting
93
+ :param string|null $locale: The locale to use for formatting
94
94
:param integer $fraction: Number of fraction digits after decimal point
95
95
:returns: The number as the appropriate currency for the locale
96
96
:rtype: string
97
97
98
98
Converts a number in common currency formats, like USD, EUR, GBP, etc::
99
99
100
- echo number_to_currency(1234.56, 'USD'); // Returns $1,234.56
101
- echo number_to_currency(1234.56, 'EUR'); // Returns €1,234.56
102
- echo number_to_currency(1234.56, 'GBP'); // Returns £1,234.56
103
- echo number_to_currency(1234.56, 'YEN'); // Returns YEN1,234.56
100
+ echo number_to_currency(1234.56, 'USD', 'en_US', 2); // Returns $1,234.56
101
+ echo number_to_currency(1234.56, 'EUR', 'de_DE', 2); // Returns 1.234,56 €
102
+ echo number_to_currency(1234.56, 'GBP', 'en_GB', 2); // Returns £1,234.56
103
+ echo number_to_currency(1234.56, 'YEN', 'ja_JP', 2); // Returns YEN 1,234.56
104
+
105
+ If you don't specify a locale, the Request locale is used.
104
106
105
107
.. php :function :: number_to_roman($num)
106
108
0 commit comments