gmp_clrbit


gmp apg

CLEAR a bit if is set.





$index = 0 represents the least significant bit.

Unlike most of the other GMP functions, this function must be called with a GMP object that already exists (using gmp_init for example).

One will not be automatically created.



<?php

void gmp_clrbit 
( GMP $num, int $index )


where,

$num = The value to clear

$index 
= The index of the bit to clear

?>
 

$num


The value to be cleared.



$index


The index of the bit to be cleared.



  1 EXERCISE   

<?php

$a01 
= gmp_init('0xAADD');
// 43741 (DECIMAL)

$arri01 = [ 0, 1, 2, 3, 4, 5, 6, 7, 64 ];

foreach(
$arri01 as $i01)
{
gmp_clrbit($a01, $i01);

echo 
'Bit cleared ' . $i01 . ' returned value ' . 
                                       
gmp_strval($a01) . ' = ' . 
                                       
strtoupper(dechex(gmp_strval($a01))) . '<br><br>';
}

?>