The gmp_scan0() is an inbuilt function which is used to scan “0” in a GMP number(GNU Multiple Precision : For large numbers) starting from given index which move towards most significant bits in the number.
Parameters: This function accepts two parameters as explained below:
- $num: This parameter is a GMP number and is mandatory to be passed. This parameter can be a GMP object in PHP version 5.6 and later, or we are also allowed to pass a numeric string provided that it is possible to convert that string to a number.
- $index: This parameter represents the index or position in the bitwise representation of the number $num from where we want to start the search.
Return Value: The function returns the position where we find “0” in the number.
Input : gmp_scan0("101111101", 6) Output : 7 Input : gmp_scan0("111001111", 2) Output : 4
Below programs illustrate the gmp_scan0() function in PHP:
Program 1: Program to find the position of “0” bit in GMP number when numeric strings as GMP numbers are passed as arguments.
Program 2: Program to find the position of “0” bit in GMP number when GMP numbers are passed as arguments.
- How to get the function name inside a function in PHP ?
- D3.js | d3.hsl() Function
- D3.js | d3.sum() function
- PHP | exp() Function
- PHP | Ds\Map xor() Function
- PHP | cos( ) Function
- PHP | sin( ) Function
- PHP | tan( ) Function
- PHP | Ds\Map put() Function
- D3.js | d3.max() function
- PHP | pi( ) Function
- D3.js | d3.set.has() Function
- PHP | next() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.