Skip to content

Commit ad3a204

Browse files
committed
docs: fix number_helper.rst
1 parent a6eb95d commit ad3a204

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

user_guide_src/source/helpers/number_helper.rst

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Available Functions
2727

2828
The following functions are available:
2929

30-
.. php:function:: number_to_size($num[, $precision = 1[, $locale = null])
30+
.. php:function:: number_to_size($num[, $precision = 1[, $locale = null]])
3131
3232
:param mixed $num: Number of bytes
3333
:param int $precision: Floating point precision
@@ -86,21 +86,23 @@ The following functions are available:
8686

8787
echo number_to_amount('123,456,789,012', 2, 'de_DE'); // Returns 123,46 billion
8888

89-
.. php:function:: number_to_currency($num, $currency[, $locale = null])
89+
.. php:function:: number_to_currency($num, $currency[, $locale = null[, $fraction = 0]])
9090
91-
:param mixed $num: Number to format
91+
:param float $num: Number to format
9292
: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
9494
:param integer $fraction: Number of fraction digits after decimal point
9595
:returns: The number as the appropriate currency for the locale
9696
:rtype: string
9797

9898
Converts a number in common currency formats, like USD, EUR, GBP, etc::
9999

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.
104106

105107
.. php:function:: number_to_roman($num)
106108

0 commit comments

Comments
 (0)