Query: numfmt_set_attribute
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
NUMFMT_SET_ATTRIBUTE(3) 1 NUMFMT_SET_ATTRIBUTE(3) NumberFormatter::setAttribute - Set an attribute Object oriented styleSYNOPSISpublic bool NumberFormatter::setAttribute (int $attr, int $value)DESCRIPTIONProcedural style bool numfmt_set_attribute (NumberFormatter $fmt, int $attr, int $value) Set 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. o $value - The attribute value.RETURN VALUESReturns TRUE on success or FALSE on failure.EXAMPLESExample #1 numfmt_set_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_attribute(3), numfmt_set_text_attribute(3). PHP Documentation Group NUMFMT_SET_ATTRIBUTE(3)
Related Man Pages |
---|
numfmt_get_attribute(3) - php |
numfmt_set_attribute(3) - php |
numfmt_set_pattern(3) - php |
numfmt_set_symbol(3) - php |
numfmt_set_text_attribute(3) - php |
Similar Topics in the Unix Linux Community |
---|
rename using mv ? |
Only Digits as input |
sed coding |
if $varib contains non-numeric charctr then... |
Searching for Multiple texts in a file |