Query: numfmt_get_attribute
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
NUMFMT_GET_ATTRIBUTE(3) 1 NUMFMT_GET_ATTRIBUTE(3) NumberFormatter::getAttribute - Get an attribute Object oriented styleSYNOPSISpublic int NumberFormatter::getAttribute (int $attr)DESCRIPTIONProcedural style int numfmt_get_attribute (NumberFormatter $fmt, int $attr) Get a numeric attribute associated with the formatter. An example of a numeric attribute is the number of integer digits the formatter will produce.PARAMETERSo $fmt -NumberFormatter object. o $attr - Attribute specifier - one of the numeric attribute constants.RETURN VALUESReturn attribute value on success, or FALSE on error.EXAMPLESExample #1 numfmt_get_attribute(3) example <?php $fmt = numfmt_create( 'de_DE', NumberFormatter::DECIMAL ); echo "Digits: ".numfmt_get_attribute($fmt, NumberFormatter::MAX_FRACTION_DIGITS)." "; echo numfmt_format($fmt, 1234567.891234567890000)." "; numfmt_set_attribute($fmt, NumberFormatter::MAX_FRACTION_DIGITS, 2); echo "Digits: ".numfmt_get_attribute($fmt, NumberFormatter::MAX_FRACTION_DIGITS)." "; echo numfmt_format($fmt, 1234567.891234567890000)." "; ?> Example #2 OO example <?php $fmt = new NumberFormatter( 'de_DE', NumberFormatter::DECIMAL ); echo "Digits: ".$fmt->getAttribute(NumberFormatter::MAX_FRACTION_DIGITS)." "; echo $fmt->format(1234567.891234567890000)." "; $fmt->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, 2); echo "Digits: ".$fmt->getAttribute(NumberFormatter::MAX_FRACTION_DIGITS)." "; echo $fmt->format(1234567.891234567890000)." "; ?> The above example will output: Digits: 3 1.234.567,891 Digits: 2 1.234.567,89SEE ALSOnumfmt_get_error_code(3), numfmt_get_text_attribute(3), numfmt_set_attribute(3). PHP Documentation Group NUMFMT_GET_ATTRIBUTE(3)
Related Man Pages |
---|
numfmt_create(3) - php |
numberformatter(3) - php |
datefmt_get_pattern(3) - php |
datefmt_set_lenient(3) - php |
numberformatter.gettextattribute(3) - php |
Similar Topics in the Unix Linux Community |
---|
Combinations |
Only Digits as input |
Digits display |
echo + bc + format |
print ODD lines |