Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

gmp_scan1

Description

The gmp_scan1 of GMP for PHP scans for 1.

Syntax

gmp_scan1(
    GMP|int|string $num,
    int $start
): int

Parameters

num

The number to scan.

A GMP object, an int or a numeric string.

start

The starting bit.

Return

Returns the index of the found bit, as an int. If no set bit is found, -1 is returned.

Examples

1 · num · GMP

<?

$num = 0b010;
$start = 0;

$num = gmp_init($num);

$return = gmp_scan1($num, $start);

echo $return;

?>
1

2 · num · int

<?

$num = 0b010;
$start = 0;

$return = gmp_scan1($num, $start);

echo $return;

?>
1

3 · num · string

<?

$num = "0b010";
$start = 0;

$return = gmp_scan1($num, $start);

echo $return;

?>
1

4 · start

<?

$num = "0b010";
$start = 2;

$return = gmp_scan1($num, $start);

echo $return;

?>
-1
HomeMenu