Internationalization NumberFormatter::parseCurrency

NumberFormatter::parseCurrency

numfmt_parse_currency

(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)

NumberFormatter::parseCurrency -- numfmt_parse_currency — currency number 구문 분석


설명

객체 지향 스타일 (method)

public NumberFormatter::parseCurrency(string $string, string &$currency, int &$offset = null): float|false

절차적 스타일

numfmt_parse_currency(NumberFormatter $formatter, string $string, string &$currency, int &$offset = null): float|false

현재 포맷터를 사용하여 문자열을 double 및 currency로 구문 분석합니다.


매개변수

formatter
NumberFormatter object.
currency
통화 이름을 수신하는 매개변수입니다(3자리 ISO 4217 통화 코드).
offset
구문 분석을 시작할 문자열의 오프셋입니다. 반환 시 이 값은 구문 분석이 종료된 오프셋을 유지합니다.

반환 값

구문 분석된 숫자 값 또는 오류 시 false입니다.


Examples

예제 #1 numfmt_parse_currency() 예제

                  
<?php
$fmt = numfmt_create( 'de_DE', NumberFormatter::CURRENCY );
$num = "1.234.567,89\xc2\xa0$";
echo "We have ".numfmt_parse_currency($fmt, $num, $curr)." in $curr\n";
?>
                  
                

예제 #2 OO 예제

                  
<?php
$fmt = new NumberFormatter( 'de_DE', NumberFormatter::CURRENCY );
$num = "1.234.567,89\xc2\xa0$";
echo "We have ".$fmt->parseCurrency($num, $curr)." in $curr\n";
?>
                  
                

위의 예는 다음을 출력합니다.

We have 1234567.89 in USD
                

기타