<?php
int gmp_scan0 ( GMP|int|string $num1, int $start )
where,
$num1 = The GMP number to scan
$start = The starting bit
?>
<?php
$str01 = 2;
// Try other starting bit
$num01 = "11111111";
// Try other number
$s01 = gmp_init($num01, $str01);
var_dump($s01);
echo '<br><br>';
for($b01 = 0; $b01 <= 64; $b01++)
{
$sc01 = gmp_scan0($s01, $b01);
$tb01 = gmp_testbit($s01, $b01);
echo "<br>gmp_scan0($s01, $b01) = " . gmp_scan0($s01, $b01) . '<br>';
var_dump($tb01);
echo '<br>';
}
?>
<?php
echo "gmp_scan0(\"34234\", 1) = " .
gmp_scan0("434234", 1) ."<br><br>";
echo "gmp_scan0(4096, 0) = " .
gmp_scan0(4096, 0) ."<br><br>";
echo "gmp_scan0(\"1000000000\", 5) = " .
gmp_scan0("1000000000", 5) ."<br><br>";
echo "gmp_scan0('1000000000', 200) = " .
gmp_scan0("1000000000", 200) ."<br><br>";
try {
var_dump(gmp_scan0("434234", -10));
} catch (\ValueError $e) {
echo $e->getMessage() . "<br><br>";
}
$n = gmp_init("24234527465274");
var_dump(gmp_scan0($n, 10));
try {
var_dump(gmp_scan0(array(), 200));
} catch (\TypeError $e) {
echo $e->getMessage() . "<br><br>";
}
?>