Computer >> Computer tutorials >  >> Programming >> PHP

gmp_scan0() function in PHP


The gmp_scan0() function scans “0” in a GMP number beginning from a particular index that you can set as a parameter. It moves to the most significant bits in the number.

Syntax

gmp_init(n,i)

Parameters

  • n: The GMP number to be passed.

  • i: The index from where the search begin.

Return

The gmp_scan0() function returns the index of the “0” bit. It is checked after the particular index.

Example

The following is an example:

<?php
   $val = gmp_init("01010011001", 2);
   echo gmp_scan0($val, 3);
?>

Output

The following is the output:

5