gmp_testbit
gmp_testbit
(PHP 5 >= 5.3.0, PHP 7)
gmp_testbit — Tests if a bit is set
Description
bool gmp_testbit ( GMP $a , int $index )
Tests if the specified bit is set.
Parameters
Return Values
Returns TRUE
if the bit is set in resource $a
, otherwise FALSE
.
Errors/Exceptions
An E_WARNING
level error is issued when index
is less than zero, and FALSE
is returned.
Examples
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)); ?>
The above example will output:
bool(false) bool(true)
See Also
- gmp_setbit() - Set bit
- gmp_clrbit() - Clear bit
© 1997–2017 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://secure.php.net/manual/en/function.gmp-testbit.php