PHP gmp_setbit() functionPHP programming language works with various GMP functions to operate with numerical values. The GMP function gmp_setbit() sets the index number in the base number. The function is used with three parameters, which are GMP, integer, and Boolean values. The function represents the "void" data type, and the first parameter is essential in the function. SyntaxThe syntax shows the GMP function to set the given number in the GMP base parameter. Parameters
Return ValueThis function gives the GMP parameter as an output of the given data. ExamplesThe examples show the GMP function to set the required bit using base and index values. Example1: In the given example, set the index bit value using essential parameters. Here, we are using different base numbers and different index numbers. Output: The output image displays the set bit of the GMP parameter. Example2: In the given an example, set the index bit value using essential parameters. Here, we are using the same base numbers and different index numbers. Output: The output image displays the set bit of the GMP parameter. Example3: In the given an example, set the index bit value using essential parameters. Here, we are using the same base numbers and same index numbers with a Boolean set bit. Output: The output image displays the set bit of the GMP parameter. Example4: In the given an example, set the index bit value using essential parameters. Here, we use negative base numbers and binary index numbers with GMP parameters. Output: The output image displays the set bit of the GMP parameter. Example5: In the given an example, set the index bit value using the required parameters. Here, we are using negative base numbers and integer index numbers. Output: The output image displays the set bit of the GMP parameter. ConclusionThe "gmp_setbit()" function is used to set the required value of the given GMP parameter. It helps to set values for other random range data operations and their function. Next TopicPHP GMP gmp_testbit() Function |