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

search for in the

gmp_invert> <gmp_init
[edit] Last updated: Fri, 10 Feb 2012

view this page in

gmp_intval

(PHP 4 >= 4.0.4, PHP 5)

gmp_intvalGMP 数を整数に変換する

説明

int gmp_intval ( resource $gmpnumber )

この関数により、GMP 数を整数に変換することが可能になります。

パラメータ

gmpnumber

GMP 数。

返り値

gmpnumber を整数に変換した結果を返します。

例1 gmp_intval() の例

<?php
// 正しい結果を表示します
echo gmp_intval("2147483647") . "\n";

// PHP の整数型の制限をこえているので、正しい結果を表示しません
echo gmp_intval("2147483648") . "\n";

// 正しい結果を表示します
echo gmp_strval("2147483648") . "\n";
?>

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

2147483647
2147483647
2147483648

注意

警告

この関数は、数値が実際に PHP の整数型に適合する場合(すなわち、 符号付き long 型)にのみ有用な結果を返します。単に GMP 数を出力したい場合には、gmp_strval() を使用してください。



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

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