PHP NumberFormatter::SPELLOUT tiền tệ
Phương thức này có thể được sử dụng để định dạng bất kỳ kiểu số nào được truyền trực tiếp dưới dạng đối số thứ hai. Một danh sách các thuộc tính tùy chỉnh, thuộc tính văn bản, ký hiệu và ngôn ngữ cũng có thể được chuyển Show // Simple usage default locale and related number format will be used echo $numberFormatter->format(1234.56789, \NumberFormatter::DECIMAL); // outputs: "1,234.568" if default locale is en_US // Use custom attributes and custom locale echo $numberFormatter->format( -100000.123, \NumberFormatter::DECIMAL, 'attributes' => [\NumberFormatter::GROUPING_SIZE => 4], 'textAttributes' => [\NumberFormatter::NEGATIVE_PREFIX => 'MINUS '], 'symbols' => [ \NumberFormatter::DECIMAL_SEPARATOR_SYMBOL => ',', \NumberFormatter::GROUPING_SEPARATOR_SYMBOL => '.', ], ); // outputs: "MINUS 10.0000,123" định dạngTiền tệchuỗi // Using default locale and currency echo $numberFormatter->formatCurrency(1234.56789); // outputs: "$1,234.57" if default locale is en_US and currency is 'USD' // Specify custom currency and locale echo $numberFormatter->formatCurrency(1234.56789, 'EUR', [], [], [], 'ru_RU'); // outputs: "1 234,57 €"1 Định dạng số tiền tệ. Mã tiền tệ phải được chỉ định, nếu không thì chuỗi tiền tệ mặc định // Using default locale and currency echo $numberFormatter->formatCurrency(1234.56789); // outputs: "$1,234.57" if default locale is en_US and currency is 'USD' // Specify custom currency and locale echo $numberFormatter->formatCurrency(1234.56789, 'EUR', [], [], [], 'ru_RU'); // outputs: "1 234,57 €"1 được sử dụng // Using default locale and currency echo $numberFormatter->formatCurrency(1234.56789); // outputs: "$1,234.57" if default locale is en_US and currency is 'USD' // Specify custom currency and locale echo $numberFormatter->formatCurrency(1234.56789, 'EUR', [], [], [], 'ru_RU'); // outputs: "1 234,57 €" định dạng Thập phânchuỗi // Using default locale and currency echo $numberFormatter->formatCurrency(1234.56789); // outputs: "$1,234.57" if default locale is en_US and currency is 'USD' // Specify custom currency and locale echo $numberFormatter->formatCurrency(1234.56789, 'EUR', [], [], [], 'ru_RU'); // outputs: "1 234,57 €"3 Định dạng số thập phân // Using default locale and format echo $numberFormatter->formatDecimal(1234.56789); // outputs: "1,234.568" if default locale is en_US and currency is 'USD' // Specify custom locale and attributes echo $numberFormatter->formatDecimal( 1234.56789, 'attributes' => ['fraction_digits' => 10], 'textAttributes' => ['positive_prefix' => '+',], 'symbols' => [\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL => ',', \NumberFormatter::GROUPING_SEPARATOR_SYMBOL => ' '], 'en_US' ); // outputs: "+12 345,6789000000" định dạngPhần trămchuỗi // Using default locale and currency echo $numberFormatter->formatCurrency(1234.56789); // outputs: "$1,234.57" if default locale is en_US and currency is 'USD' // Specify custom currency and locale echo $numberFormatter->formatCurrency(1234.56789, 'EUR', [], [], [], 'ru_RU'); // outputs: "1 234,57 €"4 Định dạng số phần trăm echo $numberFormatter->formatPercent(1); // outputs: "100%" echo $numberFormatter->formatPercent(.567, [], [], [], 'en_US'); // outputs: "56,7%" định dạngChính tảchuỗi // Using default locale and currency echo $numberFormatter->formatCurrency(1234.56789); // outputs: "$1,234.57" if default locale is en_US and currency is 'USD' // Specify custom currency and locale echo $numberFormatter->formatCurrency(1234.56789, 'EUR', [], [], [], 'ru_RU'); // outputs: "1 234,57 €"5 Định dạng số chính tả. Nếu ngôn ngữ không được chỉ định, ngôn ngữ mặc định sẽ được sử dụng echo $numberFormatter->formatSpellout(1); // outputs: "one" echo $numberFormatter->formatSpellout(21, [], [], [], 'en_US'); // outputs: "twenty-one" định dạngThời lượngchuỗi // Using default locale and currency echo $numberFormatter->formatCurrency(1234.56789); // outputs: "$1,234.57" if default locale is en_US and currency is 'USD' // Specify custom currency and locale echo $numberFormatter->formatCurrency(1234.56789, 'EUR', [], [], [], 'ru_RU'); // outputs: "1 234,57 €"6 Số thời lượng định dạng. Nếu ngôn ngữ không được chỉ định, ngôn ngữ mặc định sẽ được sử dụng // Using default locale and currency echo $numberFormatter->formatCurrency(1234.56789); // outputs: "$1,234.57" if default locale is en_US and currency is 'USD' // Specify custom currency and locale echo $numberFormatter->formatCurrency(1234.56789, 'EUR', [], [], [], 'ru_RU'); // outputs: "1 234,57 €"1 định dạngOrdinalchuỗi // Using default locale and currency echo $numberFormatter->formatCurrency(1234.56789); // outputs: "$1,234.57" if default locale is en_US and currency is 'USD' // Specify custom currency and locale echo $numberFormatter->formatCurrency(1234.56789, 'EUR', [], [], [], 'ru_RU'); // outputs: "1 234,57 €"7 Định dạng số thứ tự. Nếu ngôn ngữ không được chỉ định, ngôn ngữ mặc định sẽ được sử dụng // Using default locale and currency echo $numberFormatter->formatCurrency(1234.56789); // outputs: "$1,234.57" if default locale is en_US and currency is 'USD' // Specify custom currency and locale echo $numberFormatter->formatCurrency(1234.56789, 'EUR', [], [], [], 'ru_RU'); // outputs: "1 234,57 €"3 getAttributeint // Using default locale and currency echo $numberFormatter->formatCurrency(1234.56789); // outputs: "$1,234.57" if default locale is en_US and currency is 'USD' // Specify custom currency and locale echo $numberFormatter->formatCurrency(1234.56789, 'EUR', [], [], [], 'ru_RU'); // outputs: "1 234,57 €"8 Nhận thuộc tính số của intl NumberFormatter liên quan đến ngôn ngữ đã chuyển. Nếu ngôn ngữ không được thông qua, ngôn ngữ mặc định được sử dụng // Using default locale and currency echo $numberFormatter->formatCurrency(1234.56789); // outputs: "$1,234.57" if default locale is en_US and currency is 'USD' // Specify custom currency and locale echo $numberFormatter->formatCurrency(1234.56789, 'EUR', [], [], [], 'ru_RU'); // outputs: "1 234,57 €"5 getTextAttributionchuỗi // Using default locale and currency echo $numberFormatter->formatCurrency(1234.56789); // outputs: "$1,234.57" if default locale is en_US and currency is 'USD' // Specify custom currency and locale echo $numberFormatter->formatCurrency(1234.56789, 'EUR', [], [], [], 'ru_RU'); // outputs: "1 234,57 €"9 Nhận thuộc tính văn bản của intl NumberFormatter liên quan đến ngôn ngữ đã chuyển. Nếu ngôn ngữ không được thông qua, ngôn ngữ mặc định được sử dụng // Using default locale and currency echo $numberFormatter->formatCurrency(1234.56789); // outputs: "$1,234.57" if default locale is en_US and currency is 'USD' // Specify custom currency and locale echo $numberFormatter->formatCurrency(1234.56789, 'EUR', [], [], [], 'ru_RU'); // outputs: "1 234,57 €"7 getSymbolchuỗi // Using default locale and format echo $numberFormatter->formatDecimal(1234.56789); // outputs: "1,234.568" if default locale is en_US and currency is 'USD' // Specify custom locale and attributes echo $numberFormatter->formatDecimal( 1234.56789, 'attributes' => ['fraction_digits' => 10], 'textAttributes' => ['positive_prefix' => '+',], 'symbols' => [\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL => ',', \NumberFormatter::GROUPING_SEPARATOR_SYMBOL => ' '], 'en_US' ); // outputs: "+12 345,6789000000"0 Nhận biểu tượng của intl NumberFormatter liên quan đến ngôn ngữ đã chuyển. Nếu ngôn ngữ không được thông qua, ngôn ngữ mặc định sẽ được sử dụng |