(PHP 5 >= 5.3.0, PHP 7)
gmp_testbit — Tests if a bit is set
Tests if the specified bit is set.
num
Un număr GMP sub formă de resource în PHP 5.5 și anterior, un obiect GMP în PHP 5.6 și ultrior, su un șir de caractere numeric atunci când acesta poate fi convertit într-un număr.
index
The bit to test
Returns true
if the bit is set in resource $a
,
otherwise false
.
An E_WARNING
level error is issued when
index
is less than zero, and false
is returned.
Example #1 gmp_testbit() example
<?php
$n = gmp_init("1000000");
var_dump(gmp_testbit($n, 1));
gmp_setbit($n, 1);
var_dump(gmp_testbit($n, 1));
?>
Exemplul de mai sus va afișa:
bool(false) bool(true)