Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

numfmt_get_text_attribute(3) [php man page]

NUMFMT_GET_TEXT_ATTRIBUTE(3)						 1					      NUMFMT_GET_TEXT_ATTRIBUTE(3)

NumberFormatter::getTextAttribute - Get a text attribute

	Object oriented style

SYNOPSIS
public string NumberFormatter::getTextAttribute (int $attr) DESCRIPTION
Procedural style string numfmt_get_text_attribute (NumberFormatter $fmt, int $attr) Get a text attribute associated with the formatter. An example of a text attribute is the suffix for positive numbers. If the formatter does not understand the attribute, U_UNSUPPORTED_ERROR error is produced. Rule-based formatters only understand NumberFormat- ter::DEFAULT_RULESET and NumberFormatter::PUBLIC_RULESETS. PARAMETERS
o $fmt -NumberFormatter object. o $attr - Attribute specifier - one of the text attribute constants. RETURN VALUES
Return attribute value on success, or FALSE on error. EXAMPLES
Example #1 numfmt_get_text_attribute(3) example <?php $fmt = numfmt_create( 'de_DE', NumberFormatter::DECIMAL ); echo "Prefix: ".numfmt_get_text_attribute($fmt, NumberFormatter::NEGATIVE_PREFIX)." "; echo numfmt_format($fmt, -1234567.891234567890000)." "; numfmt_set_text_attribute($fmt, NumberFormatter::NEGATIVE_PREFIX, "MINUS"); echo "Prefix: ".numfmt_get_text_attribute($fmt, NumberFormatter::NEGATIVE_PREFIX)." "; echo numfmt_format($fmt, -1234567.891234567890000)." "; ?> Example #2 OO example <?php $fmt = new NumberFormatter( 'de_DE', NumberFormatter::DECIMAL ); echo "Prefix: ".$fmt->getTextAttribute(NumberFormatter::NEGATIVE_PREFIX)." "; echo $fmt->format(-1234567.891234567890000)." "; $fmt->setTextAttribute(NumberFormatter::NEGATIVE_PREFIX, "MINUS"); echo "Prefix: ".$fmt->getTextAttribute(NumberFormatter::NEGATIVE_PREFIX)." "; echo $fmt->format(-1234567.891234567890000)." "; ?> The above example will output: Prefix: - -1.234.567,891 Prefix: MINUS MINUS1.234.567,891 SEE ALSO
numfmt_get_error_code(3), numfmt_get_attribute(3), numfmt_set_text_attribute(3). PHP Documentation Group NUMFMT_GET_TEXT_ATTRIBUTE(3)

Check Out this Related Man Page

NUMFMT_CREATE(3)							 1							  NUMFMT_CREATE(3)

NumberFormatter::create - Create a number formatter

	Object oriented style (method)

SYNOPSIS
publicstatic NumberFormatter NumberFormatter::create (string $locale, int $style, [string $pattern]) DESCRIPTION
Procedural style NumberFormatter numfmt_create (string $locale, int $style, [string $pattern]) Object oriented style (constructor): NumberFormatter::__construct (string $locale, int $style, [string $pattern]) Creates a number formatter. PARAMETERS
o $locale - Locale in which the number would be formatted (locale name, e.g. en_CA). o $style - Style of the formatting, one of the format style constants. If NumberFormatter::PATTERN_DECIMAL or NumberFormatter::PAT- TERN_RULEBASED is passed then the number format is opened using the given pattern, which must conform to the syntax described in ICU DecimalFormat documentation or ICU RuleBasedNumberFormat documentation, respectively. o $pattern - Pattern string if the chosen style requires a pattern. RETURN VALUES
Returns NumberFormatter object or FALSE on error. EXAMPLES
Example #1 numfmt_create(3) example <?php $fmt = numfmt_create( 'de_DE', NumberFormatter::DECIMAL ); echo numfmt_format($fmt, 1234567.891234567890000)." "; $fmt = numfmt_create( 'it', NumberFormatter::SPELLOUT ); echo numfmt_format($fmt, 1142)." "; ?> Example #2 numfmt_create(3) example <?php $fmt = new NumberFormatter( 'de_DE', NumberFormatter::DECIMAL ); echo $fmt->format(1234567.891234567890000)." "; $fmt = new NumberFormatter( 'it', NumberFormatter::SPELLOUT ); echo $fmt->format(1142)." "; ?> The above example will output: 1.234.567,891 millicentoquarantadue SEE ALSO
numfmt_format(3), numfmt_parse(3). PHP Documentation Group NUMFMT_CREATE(3)
Man Page