Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

numfmt_parse_currency(3) [php man page]

NUMFMT_PARSE_CURRENCY(3)						 1						  NUMFMT_PARSE_CURRENCY(3)

NumberFormatter::parseCurrency - Parse a currency number

	Object oriented style

SYNOPSIS
public float NumberFormatter::parseCurrency (string $value, string &$currency, [int &$position]) DESCRIPTION
Procedural style float numfmt_parse_currency (NumberFormatter $fmt, string $value, string &$currency, [int &$position]) Parse a string into a double and a currency using the current formatter. PARAMETERS
o $fmt -NumberFormatter object. o $currency - Parameter to receive the currency name (3-letter ISO 4217 currency code). o $position - Offset in the string at which to begin parsing. On return, this value will hold the offset at which parsing ended. RETURN VALUES
The parsed numeric value or FALSE on error. EXAMPLES
Example #1 numfmt_parse_currency(3) example <?php $fmt = numfmt_create( 'de_DE', NumberFormatter::CURRENCY ); $num = "1.234.567,89xc2xa0$"; echo "We have ".numfmt_parse_currency($fmt, $num, $curr)." in $curr "; ?> Example #2 OO example <?php $fmt = new NumberFormatter( 'de_DE', NumberFormatter::CURRENCY ); $num = "1.234.567,89xc2xa0$"; echo "We have ".$fmt->parseCurrency($num, $curr)." in $curr "; ?> The above example will output: We have 1234567.89 in USD SEE ALSO
numfmt_get_error_code(3), numfmt_parse(3), numfmt_format_currency(3). PHP Documentation Group NUMFMT_PARSE_CURRENCY(3)

Check Out this Related Man Page

NUMFMT_GET_ATTRIBUTE(3) 						 1						   NUMFMT_GET_ATTRIBUTE(3)

NumberFormatter::getAttribute - Get an attribute

	Object oriented style

SYNOPSIS
public int NumberFormatter::getAttribute (int $attr) DESCRIPTION
Procedural 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. PARAMETERS
o $fmt -NumberFormatter object. o $attr - Attribute specifier - one of the numeric attribute constants. RETURN VALUES
Return attribute value on success, or FALSE on error. EXAMPLES
Example #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,89 SEE ALSO
numfmt_get_error_code(3), numfmt_get_text_attribute(3), numfmt_set_attribute(3). PHP Documentation Group NUMFMT_GET_ATTRIBUTE(3)
Man Page