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

search for in the

gmp_pow> <gmp_perfect_square
[edit] Last updated: Fri, 07 Jun 2013

view this page in

gmp_popcount

(PHP 4 >= 4.0.4, PHP 5)

gmp_popcountセットされているビットの数

説明

int gmp_popcount ( resource $a )

セットされているビットの数を返します。

パラメータ

a

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

返り値

a にセットされているビットの数を返します。

例1 gmp_popcount() の例

<?php
$pop1 
gmp_init("10000101"2); // 1 が 3 つ
echo gmp_popcount($pop1) . "\n";
$pop2 gmp_init("11111110"2); // 1 が 7 つ
echo gmp_popcount($pop2) . "\n";
?>

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

3
7



add a note add a note User Contributed Notes gmp_popcount - [0 notes]
There are no user contributed notes for this page.

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