downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

NumberFormatter::setAttribute> <NumberFormatter::parseCurrency
[edit] Last updated: Fri, 10 Feb 2012

view this page in

NumberFormatter::parse

numfmt_parse

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

NumberFormatter::parse -- numfmt_parse数値をパースする

説明

オブジェクト指向型

mixed NumberFormatter::parse ( string $value [, int $type [, int &$position ]] )

手続き型

mixed numfmt_parse ( NumberFormatter $fmt , string $value [, int $type [, int &$position ]] )

現在のフォーマット規則を使用して、文字列を数値にパースします。

パラメータ

fmt

NumberFormatter オブジェクト。

type

使用する フォーマット形式。デフォルトでは NumberFormatter::TYPE_DOUBLE を使用します。

position

文字列中でパースを開始する位置のオフセット。 結果を返す際に、この値はパース終了時のオフセットを保持します。

返り値

パースした数値、あるいはエラー時に FALSE を返します。

例1 numfmt_parse() の例

<?php
$fmt 
numfmt_create'de_DE'NumberFormatter::DECIMAL );
$num "1.234.567,891";
echo 
numfmt_parse($fmt$num)."\n";
echo 
numfmt_parse($fmt$numNumberFormatter::TYPE_INT32)."\n";
?>

例2 オブジェクト指向の例

<?php
$fmt 
= new NumberFormatter'de_DE'NumberFormatter::DECIMAL );
$num "1.234.567,891";
echo 
$fmt->parse($num)."\n";
echo 
$fmt->parse($numNumberFormatter::TYPE_INT32)."\n";
?>

上の例の出力は以下となります。

1234567.891
1234567

参考



add a note add a note User Contributed Notes NumberFormatter::parse
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites