PHP gmp_scan1() functionThe PHP programming language provides various GMP functions and data to operate with numeric operations. The GMP function gmp_scan1() is used to "scan to 1 bit" of the GMP parameter using the index value. The input number scans to 1 using index value towards the largest or most significant number. SyntaxThe syntax shows the GMP function to scan the "1" number towards the most significant GMP parameter. Parameters
Return ValueThis function shows the numerical or integer output after scanning to the "1" of the given GMP data. ExamplesThe examples show the GMP function to scan the "1" bit using base and index values. Example1: the given an example displays the position of the 1-bit value using essential parameters. Here we are using the same base value with different index values. Output: The output image shows a scan of the 1-bit value of the input data. Example2: the given an example displays the position of the 1-bit value using essential parameters. Here we use different base values with the same index value. Output: The output image shows a scan of the 1-bit value of the input data. Example3: the given an example displays the position of the 1-bit value using essential parameters. Here we use different base values with different index values Output: The output image shows a scan of the 1-bit value of the input data. Example4: the given an example displays the position of the 0-bit value using essential parameters. Output: The output image shows a scan of the 1-bit value of the input data. Example5: the given example displays the position of the 1-bit value using essential parameters. Here, we use the GMP parameters and function with the gmp_scan1() function. Output: The output image shows a scan of the 1-bit value of the input data. ConclusionThe gmp_scan1() function displays the position of the "1" bit in the given number. This function helps to get output using a single line function. Next TopicPHP gmp_setbit() function |