Required conversion character in money_format ( string $format , float $number ) function
-
10-02-2021 - |
Question
From http://us.php.net/manual/en/function.money-format.php,
It says the $format should consists of the following sequence:
- a % character
- optional flags
- optional field width
- optional left precision
- optional right precision
- a required conversion character
For the number 6 which is the conversion character part, it says we can have three choices:
i - The number is formatted according to the locale's international currency format (e.g. for the USA locale: USD 1,234.56).
n - The number is formatted according to the locale's national currency format (e.g. for the de_DE locale: EU1.234,56).
% - Returns the % character.
I understand i and n, but I don't really understand the use of %.
For example, this works,
If I use % instead of i in the conversion character part, it produces an error:
Solution
It's just so that you can write %%
if you want a literal %
to appear in your output.