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

search for in the

gmp_popcount> <gmp_or
Last updated: Fri, 06 Nov 2009

view this page in

gmp_perfect_square

(PHP 4 >= 4.0.4, PHP 5)

gmp_perfect_square平方数かどうかを調べる

説明

bool gmp_perfect_square ( resource $a )

その数が平方数であるかどうかを調べます。

パラメータ

a

平方数かどうかを調べたい数。

GMP 数リソース、 あるいは数値に変換可能な数値形式の文字列。

返り値

a が平方数の場合に TRUE、その他の場合に FALSE を返します。

例1 gmp_perfect_square() の例

<?php
// 3 * 3、平方数です
var_dump(gmp_perfect_square("9"));

// 平方数ではありません
var_dump(gmp_perfect_square("7"));

// 1234567890 * 1234567890、平方数です
var_dump(gmp_perfect_square("1524157875019052100"));
?>

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

bool(true)
bool(false)
bool(true)

参考



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

gmp_popcount> <gmp_or
Last updated: Fri, 06 Nov 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites