gmp_scan1() function in PHP


The gmp_scan1() function scans “1” in the GMP number beginning from a particular index that you can set as a parameter.

Syntax

gmp_scan1(n,i)

Parameters

  • n − The GMP number to be passed.

  • i − The index from where the search begin.

Return

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

Example

The following is an example −

<?php
   $val = gmp_init("01010001111", 2);
   echo gmp_scan1($val, 5);
?>

Output

The following is the output −

7

Updated on: 30-Jun-2020

37 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements