PHP gmp_divexact()函数

PHP gmp_divexact()函数

GMP函数用于在一行中执行数学运算。GMP divexact()函数是PHP中创建的,用于检查一个GMP数字是否可以被另一个GMP数字整除。如果函数可整除,则输出显示精确的商。如果函数不可整除,则显示数字。

语法

给定的语法使用函数来判断参数是否可整除。

<?php
gmp_divexact(parameter1, parameter2);
?>

参数

  • 该函数使用两个参数作为资源,并使用给定的函数显示值是否可被整除。

返回值

该函数返回一个数值,以判断给定的参数是否可被整除。

示例

示例1: 给定的示例显示一个值是否可被整除。该参数适用于正值或基本负值。

<!DOCTYPE html>
<html>
<body>
<h4> PHP gmp_divexact() Function </h4>
<?php
value1 = gmp_divexact("650", "5");value2 = gmp_divexact("17","5");
value3 = gmp_divexact("15","15");
echo "The division operation of the two GMP numbers: ".value1;
echo "<br/>";
echo "The division operation of the two GMP numbers: ".value2;
echo "<br/>";
echo "The division operation of the two GMP numbers: " .value3;
?>
</body>
</html>

输出:

PHP gmp_divexact()函数

示例2: 给定的示例显示了一个值是否可被整除。该参数适用于负数。

<!DOCTYPE html>
<html>
<body>
<h4> PHP gmp_divexact() Function </h4>
<?php
value1 = gmp_divexact("8505", "-50");value2 = gmp_divexact("-18","5");
value3 = gmp_divexact("-18","-18");
echo "The division operation of the two GMP numbers: ".value1;
echo "<br/>";
echo "The division operation of the two GMP numbers: ".value2;
echo "<br/>";
echo "The division operation of the two GMP numbers: " .value3;
?>
</body>
</html>

输出:

PHP gmp_divexact()函数

示例3: 给定的示例展示了一个值是否可以被除或不能被除,参数可以使用数字值来进行除法操作。

<!DOCTYPE html>
<html>
<body>
<h4> PHP gmp_divexact() Function </h4>
<?php
num1 = "2850";num2 = "20";
num3 = "1851";num4 = "37";
value1 = gmp_divexact(num1,num2);value2 = gmp_divexact(num3,num2);
value3 = gmp_divexact(num1,num4);
echo "The division operation of the two GMP numbers: ".value1;
echo "<br/>";
echo "The division operation of the two GMP numbers: ".value2;
echo "<br/>";
echo "The division operation of the two GMP numbers: " .value3;
?>
</body>
</html>

输出:

PHP gmp_divexact()函数

示例4: 给定的示例演示了除法函数与其他GMP函数的结合使用。

<!DOCTYPE html>
<html>
<body>
<h4> PHP gmp_divexact() Function </h4>
<?php
num1 = "2850";num2 = "-21";
num3 = gmp_com(num1);
num4 = gmp_abs(num2);
value1 = gmp_divexact(num4,num2);value2 = gmp_divexact(num3,num2);
value3 = gmp_divexact(num1,num4);
echo "The division operation of the two GMP numbers: ".value1;
echo "<br/>";
echo "The division operation of the two GMP numbers: ".value2;
echo "<br/>";
echo "The division operation of the two GMP numbers: " .value3;
?>
</body>
</html>

输出:

PHP gmp_divexact()函数

结论

使用GMP参数进行除法操作时,使用“gmp_divexact()”函数。它获取数字数据以获取可被除函数的值。我们可以以数字格式获取数据以判断其是否可被整除。

Camera课程

Python教程

Java教程

Web教程

数据库教程

图形图像教程

办公软件教程

Linux教程

计算机教程

大数据教程

开发工具教程