PHP gmp_scan1()函数

PHP gmp_scan1()函数

PHP编程语言提供了各种各样的GMP函数和数据来进行数字操作。GMP函数 gmp_scan1() 用于使用索引值扫描GMP参数的“扫描到1位”。输入数字使用索引值向最大或最重要的数字进行扫描。

语法

语法显示了GMP函数向最重要的GMP参数扫描“1”数字。

<?php
gmp_scan1(base_value,index_value);
?>

参数

  • 该函数需要两个参数:第一个参数为$base_value,第二个参数为$index_value。gmp_scan1() 函数和其操作都依赖于这两个变量。
  • GMP 函数适用于 PHP 5.6 及以上版本,可以处理各种输入数据。GMP 字符串值会转换为数字。
    • $base_value :这是一个 GMP 参数,表示整数数据返回作为基础值的一部分或函数的输出。它用于找到基础值的 1 位位置。
    • $index_value :这是一个整数参数,用于使用 $index_value 扫描 $base_value 中的 1。

返回值

该函数在扫描给定的 GMP 数据中的 “1” 位后显示数值或整数输出。

示例

示例展示了使用基础值和索引值扫描 “1” 位的 GMP 函数。

示例1: 给定的示例显示了使用必要参数来确定 1 位值的位置。我们在这里使用相同的基础值和不同的索引值。

<!DOCTYPE html>
<html>
<body>
<h4> PHP gmp_scan1() Function </h4>
<p> Scan the position of the 1 bit using function and its parameter </p>
<?php
value1 = gmp_scan1("11111111", "2");value2 = gmp_scan1("11111111", "4");
value3 = gmp_scan1("11111111", "1");value4 = gmp_scan1("11111111", "3");
echo "The position of the 1 bit using GMP parameters : " .value1;
echo "<br/>";
echo " The position of the 1 bit using GMP parameters: " .value2;
echo "<br/>";
echo " The position of the 1 bit using GMP parameters: " .value3;
echo "<br/>";
echo " The position of the 1 bit using GMP parameters:  " .value4;
?>
</body>
</html>

输出:

输出图片显示了输入数据的一位值的扫描结果。

PHP gmp_scan1()函数

示例2: 给出的示例显示了使用基本参数显示1位值的位置。在这里,我们使用不同的基值和相同的索引值。

<!DOCTYPE html>
<html>
<body>
<h4> PHP gmp_scan1() Function </h4>
<p> Scan the position of the 1 bit using function and its parameter </p>
<?php
value1 = gmp_scan1("1111", "2");value2 = gmp_scan1("11100111", "2");
value3 = gmp_scan1("0011100", "2");value4 = gmp_scan1("1111001", "2");
echo "The position of the 1 bit using GMP parameters : " .value1;
echo "<br/>";
echo " The position of the 1 bit using GMP parameters: " .value2;
echo "<br/>";
echo " The position of the 1 bit using GMP parameters: " .value3;
echo "<br/>";
echo " The position of the 1 bit using GMP parameters:  " .value4;
?>
</body>
</html>

输出:

输出图像显示了输入数据的1位值的扫描结果。

PHP gmp_scan1()函数

示例3: 给定一个示例,使用必要的参数显示1位值的位置。这里我们使用不同的基值和不同的索引值。

<!DOCTYPE html>
<html>
<body>
<h4> PHP gmp_scan1() Function </h4>
<p> Scan the position of the 1 bit using function and its parameter </p>
<?php
value1 = gmp_scan1("10001111", "2");value2 = gmp_scan1("111000111", "4");
value3 = gmp_scan1("00001111", "1");value4 = gmp_scan1("0011110000", "3");
echo "The position of the 1 bit using GMP parameters : " .value1;
echo "<br/>";
echo " The position of the 1 bit using GMP parameters: " .value2;
echo "<br/>";
echo " The position of the 1 bit using GMP parameters: " .value3;
echo "<br/>";
echo " The position of the 1 bit using GMP parameters:  " .value4;
?>
</body>
</html>

输出:

输出图像显示了输入数据的1位值的扫描结果。

PHP gmp_scan1()函数

示例4: 给定的示例显示了使用必要参数的0位值的位置。

<!DOCTYPE html>
<html>
<body>
<h4> PHP gmp_scan1() Function </h4>
<p> Scan the position of the 1 bit using function and its parameter </p>
<?php
var1 = gmp_init("1111111");var2 = gmp_init("11001100");
var3 = gmp_init("11011101");index_var1 = "2";
index_var2 = "3";index_var3 = "4";
value1 = gmp_scan1(var1, index_var1);value2 = gmp_scan1(var2,index_var2);
value3 = gmp_scan1(var3, index_var3);
echo "The position of the 1 bit using GMP parameters : " .value1;
echo "<br/>";
echo " The position of the 1 bit using GMP parameters: " .value2;
echo "<br/>";
echo " The position of the 1 bit using GMP parameters: " .value3;
?>
</body>
</html>

输出:

输出图像显示了输入数据的1位值的扫描结果。

PHP gmp_scan1()函数

示例5: 给定的示例使用必要的参数显示1位值的位置。在这里,我们使用GMP参数和函数与gmp_scan1()函数。

<!DOCTYPE html
<html>
<body>
<h4> PHP gmp_scan1() Function </h4>
<p> Scan the position of the 1 bit using function and its parameter </p>
<?php
var1 = gmp_init("5130101");var2 = gmp_neg("-5000");
var3 = gmp_com("-11011101");var4 = gmp_abs("-1450211");
index_var1 = "2";index_var2 = "3";
index_var3 = "4";value1 = gmp_scan1(var1,index_var1);
value2 = gmp_scan1(var2, index_var2);value3 = gmp_scan1(var3,index_var3);
value4 = gmp_scan1(var4, index_var3);
echo "The position of the 1 bit using GMP parameters : " .value1;
echo "<br/>";
echo " The position of the 1 bit using GMP parameters: " .value2;
echo "<br/>";
echo " The position of the 1 bit using GMP parameters: " .value3;
echo "<br/>";
echo " The position of the 1 bit using GMP parameters: " .$value4;
?>
</body>
</html>

输出:

输出图像显示了输入数据的1位值的扫描。

PHP gmp_scan1()函数

结论

gmp_scan1()函数显示了给定数字中“1”位的位置。此函数帮助使用单行函数获取输出。

Camera课程

Python教程

Java教程

Web教程

数据库教程

图形图像教程

办公软件教程

Linux教程

计算机教程

大数据教程

开发工具教程