Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

numfmt_parse(3) [php man page]

NUMFMT_PARSE(3) 							 1							   NUMFMT_PARSE(3)

NumberFormatter::parse - Parse a number

	Object oriented style

SYNOPSIS
public mixed NumberFormatter::parse (string $value, [int $type], [int &$position]) DESCRIPTION
Procedural style mixed numfmt_parse (NumberFormatter $fmt, string $value, [int $type], [int &$position]) Parse a string into a number using the current formatter rules. PARAMETERS
o $fmt -NumberFormatter object. o $type - The formatting type to use. By default, NumberFormatter::TYPE_DOUBLE is used. 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 value of the parsed number or FALSE on error. EXAMPLES
Example #1 numfmt_parse(3) example <?php $fmt = numfmt_create( 'de_DE', NumberFormatter::DECIMAL ); $num = "1.234.567,891"; echo numfmt_parse($fmt, $num)." "; echo numfmt_parse($fmt, $num, NumberFormatter::TYPE_INT32)." "; ?> Example #2 OO example <?php $fmt = new NumberFormatter( 'de_DE', NumberFormatter::DECIMAL ); $num = "1.234.567,891"; echo $fmt->parse($num)." "; echo $fmt->parse($num, NumberFormatter::TYPE_INT32)." "; ?> The above example will output: 1234567.891 1234567 SEE ALSO
numfmt_get_error_code(3), numfmt_format(3), numfmt_parse_currency(3). PHP Documentation Group NUMFMT_PARSE(3)

Check Out this Related Man Page

NUMFMT_GET_SYMBOL(3)							 1						      NUMFMT_GET_SYMBOL(3)

NumberFormatter::getSymbol - Get a symbol value

	Object oriented style

SYNOPSIS
public string NumberFormatter::getSymbol (int $attr) DESCRIPTION
Procedural style string numfmt_get_symbol (NumberFormatter $fmt, int $attr) Get a symbol associated with the formatter. The formatter uses symbols to represent the special locale-dependent characters in a number, for example the percent sign. This API is not supported for rule-based formatters. PARAMETERS
o $fmt -NumberFormatter object. o $attr - Symbol specifier, one of the format symbol constants. RETURN VALUES
The symbol string or FALSE on error. EXAMPLES
Example #1 numfmt_get_symbol(3) example <?php $fmt = numfmt_create( 'de_DE', NumberFormatter::DECIMAL ); echo "Sep: ".numfmt_get_symbol($fmt, NumberFormatter::GROUPING_SEPARATOR_SYMBOL)." "; echo numfmt_format($fmt, 1234567.891234567890000)." "; numfmt_set_symbol($fmt, NumberFormatter::GROUPING_SEPARATOR_SYMBOL, "*"); echo "Sep: ".numfmt_get_symbol($fmt, NumberFormatter::GROUPING_SEPARATOR_SYMBOL)." "; echo numfmt_format($fmt, 1234567.891234567890000)." "; ?> Example #2 OO example <?php $fmt = new NumberFormatter( 'de_DE', NumberFormatter::DECIMAL ); echo "Sep: ".$fmt->getSymbol(NumberFormatter::GROUPING_SEPARATOR_SYMBOL)." "; echo $fmt->format(1234567.891234567890000)." "; $fmt->setSymbol(NumberFormatter::GROUPING_SEPARATOR_SYMBOL, "*"); echo "Sep: ".$fmt->getSymbol(NumberFormatter::GROUPING_SEPARATOR_SYMBOL)." "; echo $fmt->format(1234567.891234567890000)." "; ?> The above example will output: Sep: . 1.234.567,891 Sep: * 1*234*567,891 SEE ALSO
numfmt_get_error_code(3), numfmt_set_symbol(3). PHP Documentation Group NUMFMT_GET_SYMBOL(3)
Man Page